aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exportfs/expfs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:22:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:22:40 -0400
commit5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (patch)
treeaf19ed28db83e8f52690872ac99336da1cf2fd3b /fs/exportfs/expfs.c
parent5b34653963de7a6d0d8c783527457d68fddc60fb (diff)
parentfd217f4d70172c526478f2bc76859e909fdfa674 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (46 commits) [PATCH] fs: add a sanity check in d_free [PATCH] i_version: remount support [patch] vfs: make security_inode_setattr() calling consistent [patch 1/3] FS_MBCACHE: don't needlessly make it built-in [PATCH] move executable checking into ->permission() [PATCH] fs/dcache.c: update comment of d_validate() [RFC PATCH] touch_mnt_namespace when the mount flags change [PATCH] reiserfs: add missing llseek method [PATCH] fix ->llseek for more directories [PATCH vfs-2.6 6/6] vfs: add LOOKUP_RENAME_TARGET intent [PATCH vfs-2.6 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup [PATCH vfs-2.6 4/6] vfs: remove unnecessary fsnotify_d_instantiate() [PATCH vfs-2.6 3/6] vfs: add __d_instantiate() helper [PATCH vfs-2.6 2/6] vfs: add d_ancestor() [PATCH vfs-2.6 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() [PATCH] get rid of on-stack dentry in udf [PATCH 2/2] anondev: switch to IDA [PATCH 1/2] anondev: init IDR statically [JFFS2] Use d_splice_alias() not d_add() in jffs2_lookup() [PATCH] Optimise NFS readdir hack slightly. ...
Diffstat (limited to 'fs/exportfs/expfs.c')
-rw-r--r--fs/exportfs/expfs.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index cc91227d3bb8..80246bad1b7f 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -94,9 +94,8 @@ find_disconnected_root(struct dentry *dentry)
94 * It may already be, as the flag isn't always updated when connection happens. 94 * It may already be, as the flag isn't always updated when connection happens.
95 */ 95 */
96static int 96static int
97reconnect_path(struct vfsmount *mnt, struct dentry *target_dir) 97reconnect_path(struct vfsmount *mnt, struct dentry *target_dir, char *nbuf)
98{ 98{
99 char nbuf[NAME_MAX+1];
100 int noprogress = 0; 99 int noprogress = 0;
101 int err = -ESTALE; 100 int err = -ESTALE;
102 101
@@ -281,13 +280,14 @@ static int get_name(struct vfsmount *mnt, struct dentry *dentry,
281 int old_seq = buffer.sequence; 280 int old_seq = buffer.sequence;
282 281
283 error = vfs_readdir(file, filldir_one, &buffer); 282 error = vfs_readdir(file, filldir_one, &buffer);
283 if (buffer.found) {
284 error = 0;
285 break;
286 }
284 287
285 if (error < 0) 288 if (error < 0)
286 break; 289 break;
287 290
288 error = 0;
289 if (buffer.found)
290 break;
291 error = -ENOENT; 291 error = -ENOENT;
292 if (old_seq == buffer.sequence) 292 if (old_seq == buffer.sequence)
293 break; 293 break;
@@ -360,14 +360,13 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
360{ 360{
361 const struct export_operations *nop = mnt->mnt_sb->s_export_op; 361 const struct export_operations *nop = mnt->mnt_sb->s_export_op;
362 struct dentry *result, *alias; 362 struct dentry *result, *alias;
363 char nbuf[NAME_MAX+1];
363 int err; 364 int err;
364 365
365 /* 366 /*
366 * Try to get any dentry for the given file handle from the filesystem. 367 * Try to get any dentry for the given file handle from the filesystem.
367 */ 368 */
368 result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); 369 result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type);
369 if (!result)
370 result = ERR_PTR(-ESTALE);
371 if (IS_ERR(result)) 370 if (IS_ERR(result))
372 return result; 371 return result;
373 372
@@ -381,7 +380,7 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
381 * filesystem root. 380 * filesystem root.
382 */ 381 */
383 if (result->d_flags & DCACHE_DISCONNECTED) { 382 if (result->d_flags & DCACHE_DISCONNECTED) {
384 err = reconnect_path(mnt, result); 383 err = reconnect_path(mnt, result, nbuf);
385 if (err) 384 if (err)
386 goto err_result; 385 goto err_result;
387 } 386 }
@@ -397,7 +396,6 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
397 * It's not a directory. Life is a little more complicated. 396 * It's not a directory. Life is a little more complicated.
398 */ 397 */
399 struct dentry *target_dir, *nresult; 398 struct dentry *target_dir, *nresult;
400 char nbuf[NAME_MAX+1];
401 399
402 /* 400 /*
403 * See if either the dentry we just got from the filesystem 401 * See if either the dentry we just got from the filesystem
@@ -422,8 +420,6 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
422 420
423 target_dir = nop->fh_to_parent(mnt->mnt_sb, fid, 421 target_dir = nop->fh_to_parent(mnt->mnt_sb, fid,
424 fh_len, fileid_type); 422 fh_len, fileid_type);
425 if (!target_dir)
426 goto err_result;
427 err = PTR_ERR(target_dir); 423 err = PTR_ERR(target_dir);
428 if (IS_ERR(target_dir)) 424 if (IS_ERR(target_dir))
429 goto err_result; 425 goto err_result;
@@ -433,7 +429,7 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
433 * connected to the filesystem root. The VFS really doesn't 429 * connected to the filesystem root. The VFS really doesn't
434 * like disconnected directories.. 430 * like disconnected directories..
435 */ 431 */
436 err = reconnect_path(mnt, target_dir); 432 err = reconnect_path(mnt, target_dir, nbuf);
437 if (err) { 433 if (err) {
438 dput(target_dir); 434 dput(target_dir);
439 goto err_result; 435 goto err_result;