diff options
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/namei.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 0bb2c2010b95..b72847988b78 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
@@ -508,31 +508,29 @@ static struct dentry *nilfs_fh_to_parent(struct super_block *sb, struct fid *fh, | |||
508 | return nilfs_get_dentry(sb, fid->cno, fid->parent_ino, fid->parent_gen); | 508 | return nilfs_get_dentry(sb, fid->cno, fid->parent_ino, fid->parent_gen); |
509 | } | 509 | } |
510 | 510 | ||
511 | static int nilfs_encode_fh(struct dentry *dentry, __u32 *fh, int *lenp, | 511 | static int nilfs_encode_fh(struct inode *inode, __u32 *fh, int *lenp, |
512 | int connectable) | 512 | struct inode *parent) |
513 | { | 513 | { |
514 | struct nilfs_fid *fid = (struct nilfs_fid *)fh; | 514 | struct nilfs_fid *fid = (struct nilfs_fid *)fh; |
515 | struct inode *inode = dentry->d_inode; | ||
516 | struct nilfs_root *root = NILFS_I(inode)->i_root; | 515 | struct nilfs_root *root = NILFS_I(inode)->i_root; |
517 | int type; | 516 | int type; |
518 | 517 | ||
519 | if (*lenp < NILFS_FID_SIZE_NON_CONNECTABLE || | 518 | if (parent && *lenp < NILFS_FID_SIZE_CONNECTABLE) { |
520 | (connectable && *lenp < NILFS_FID_SIZE_CONNECTABLE)) | 519 | *lenp = NILFS_FID_SIZE_CONNECTABLE; |
520 | return 255; | ||
521 | } | ||
522 | if (*lenp < NILFS_FID_SIZE_NON_CONNECTABLE) { | ||
523 | *lenp = NILFS_FID_SIZE_NON_CONNECTABLE; | ||
521 | return 255; | 524 | return 255; |
525 | } | ||
522 | 526 | ||
523 | fid->cno = root->cno; | 527 | fid->cno = root->cno; |
524 | fid->ino = inode->i_ino; | 528 | fid->ino = inode->i_ino; |
525 | fid->gen = inode->i_generation; | 529 | fid->gen = inode->i_generation; |
526 | 530 | ||
527 | if (connectable && !S_ISDIR(inode->i_mode)) { | 531 | if (parent) { |
528 | struct inode *parent; | ||
529 | |||
530 | spin_lock(&dentry->d_lock); | ||
531 | parent = dentry->d_parent->d_inode; | ||
532 | fid->parent_ino = parent->i_ino; | 532 | fid->parent_ino = parent->i_ino; |
533 | fid->parent_gen = parent->i_generation; | 533 | fid->parent_gen = parent->i_generation; |
534 | spin_unlock(&dentry->d_lock); | ||
535 | |||
536 | type = FILEID_NILFS_WITH_PARENT; | 534 | type = FILEID_NILFS_WITH_PARENT; |
537 | *lenp = NILFS_FID_SIZE_CONNECTABLE; | 535 | *lenp = NILFS_FID_SIZE_CONNECTABLE; |
538 | } else { | 536 | } else { |