~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to fs/nfs/getroot.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
/*
76
76
 * get an NFS2/NFS3 root dentry from the root filehandle
77
77
 */
78
 
struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
 
78
struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh,
 
79
                            const char *devname)
79
80
{
80
81
        struct nfs_server *server = NFS_SB(sb);
81
82
        struct nfs_fsinfo fsinfo;
82
83
        struct dentry *ret;
83
84
        struct inode *inode;
 
85
        void *name = kstrdup(devname, GFP_KERNEL);
84
86
        int error;
85
87
 
 
88
        if (!name)
 
89
                return ERR_PTR(-ENOMEM);
 
90
 
86
91
        /* get the actual root for this mount */
87
92
        fsinfo.fattr = nfs_alloc_fattr();
88
 
        if (fsinfo.fattr == NULL)
 
93
        if (fsinfo.fattr == NULL) {
 
94
                kfree(name);
89
95
                return ERR_PTR(-ENOMEM);
 
96
        }
90
97
 
91
98
        error = server->nfs_client->rpc_ops->getroot(server, mntfh, &fsinfo);
92
99
        if (error < 0) {
119
126
        }
120
127
 
121
128
        security_d_instantiate(ret, inode);
 
129
        spin_lock(&ret->d_lock);
 
130
        if (IS_ROOT(ret) && !(ret->d_flags & DCACHE_NFSFS_RENAMED)) {
 
131
                ret->d_fsdata = name;
 
132
                name = NULL;
 
133
        }
 
134
        spin_unlock(&ret->d_lock);
122
135
out:
 
136
        if (name)
 
137
                kfree(name);
123
138
        nfs_free_fattr(fsinfo.fattr);
124
139
        return ret;
125
140
}
169
184
/*
170
185
 * get an NFS4 root dentry from the root filehandle
171
186
 */
172
 
struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
 
187
struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh,
 
188
                             const char *devname)
173
189
{
174
190
        struct nfs_server *server = NFS_SB(sb);
175
191
        struct nfs_fattr *fattr = NULL;
176
192
        struct dentry *ret;
177
193
        struct inode *inode;
 
194
        void *name = kstrdup(devname, GFP_KERNEL);
178
195
        int error;
179
196
 
180
197
        dprintk("--> nfs4_get_root()\n");
181
198
 
 
199
        if (!name)
 
200
                return ERR_PTR(-ENOMEM);
 
201
 
182
202
        /* get the info about the server and filesystem */
183
203
        error = nfs4_server_capabilities(server, mntfh);
184
204
        if (error < 0) {
185
205
                dprintk("nfs_get_root: getcaps error = %d\n",
186
206
                        -error);
 
207
                kfree(name);
187
208
                return ERR_PTR(error);
188
209
        }
189
210
 
190
211
        fattr = nfs_alloc_fattr();
191
 
        if (fattr == NULL)
192
 
                return ERR_PTR(-ENOMEM);;
 
212
        if (fattr == NULL) {
 
213
                kfree(name);
 
214
                return ERR_PTR(-ENOMEM);
 
215
        }
193
216
 
194
217
        /* get the actual root for this mount */
195
218
        error = server->nfs_client->rpc_ops->getattr(server, mntfh, fattr);
199
222
                goto out;
200
223
        }
201
224
 
 
225
        if (fattr->valid & NFS_ATTR_FATTR_FSID &&
 
226
            !nfs_fsid_equal(&server->fsid, &fattr->fsid))
 
227
                memcpy(&server->fsid, &fattr->fsid, sizeof(server->fsid));
 
228
 
202
229
        inode = nfs_fhget(sb, mntfh, fattr);
203
230
        if (IS_ERR(inode)) {
204
231
                dprintk("nfs_get_root: get root inode failed\n");
223
250
        }
224
251
 
225
252
        security_d_instantiate(ret, inode);
226
 
 
 
253
        spin_lock(&ret->d_lock);
 
254
        if (IS_ROOT(ret) && !(ret->d_flags & DCACHE_NFSFS_RENAMED)) {
 
255
                ret->d_fsdata = name;
 
256
                name = NULL;
 
257
        }
 
258
        spin_unlock(&ret->d_lock);
227
259
out:
 
260
        if (name)
 
261
                kfree(name);
228
262
        nfs_free_fattr(fattr);
229
263
        dprintk("<-- nfs4_get_root()\n");
230
264
        return ret;