lkml.org 
[lkml]   [2012]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v5 5/8] fat: restructure export_operations
Date
Namjae Jeon <linkinjeon@gmail.com> writes:

>> I know encode_fh(). But NFS is network protocol, and network can input
>> any data, and I guess the userland interface (open_by_handle()?) can be
>> any too.
>>
>> And generic_fh_to_dentry()'s input verify choose to check the minimum
>> length only. But your logic choose the exact length.
>>
>> I think the both is sane and correct. But I wonder why did you changed it.
> There was no particular reason for us to put those conditions. It is
> just we knew what fh lengths we have chosen for the 2 cases
> WITH/WITHOUT parent.
> i.e., we checked with encoded length.
> Now, when I check the export functions of other filesystems(btrfs,
> nilfs2, udf). They also adopt the same method of checking the exact
> length and type.
> If there is any particular reason, we will look into that and can also
> updated on that.

OK. Then, just cleanup code, and let's use strict checking version.

Removing strange fallthrou, something like the following.

static struct dentry *fat_fh_to_dentry_nostale(struct super_block *sb,
struct fid *fh, int fh_len,
int fh_type)
{
struct inode *inode = NULL;
struct fat_fid *fid = (struct fat_fid *)fh;
loff_t i_pos;

switch (fh_type) {
case FILEID_FAT_WITHOUT_PARENT:
if (fh_len < FAT_FID_SIZE_WITHOUT_PARENT)
return NULL;
break;
case FILEID_FAT_WITH_PARENT:
if (fh_len < FAT_FID_SIZE_WITH_PARENT)
return NULL;
break;
default:
return NULL;
}

i_pos = fid->i_pos_hi;
i_pos = (i_pos << 32) | (fid->i_pos_low);
inode = __fat_nfs_get_inode(sb, 0, fid->i_gen, i_pos);

return d_obtain_alias(inode);
}


--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>


\
 
 \ /
  Last update: 2012-12-06 11:02    [W:0.041 / U:2.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site