aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exportfs/expfs.c
diff options
context:
space:
mode:
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;