[LU-5954] IOC_MDC_GETFILEINFO returns the wrong ino Created: 25/Nov/14  Updated: 15/Jun/16  Resolved: 15/Jun/16

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.7.0
Fix Version/s: Lustre 2.9.0

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: WC Triage
Resolution: Fixed Votes: 0
Labels: llapi, patch

Severity: 3
Rank (Obsolete): 16632

 Description   

If the command is IOC_MDC_GETFILEINFO then ll_dir_ioctl() should be returning the ino derived from the body but is instead returning the ino of the parent.

        skip_lmm:
                if (cmd == IOC_MDC_GETFILEINFO || cmd == LL_IOC_MDC_GETINFO) {
                        struct lov_user_mds_data __user *lmdp;
                        lstat_t st = { 0 };

                        st.st_dev       = inode->i_sb->s_dev;
			st.st_mode      = body->mbo_mode;
                        st.st_nlink     = body->mbo_nlink;
                        st.st_uid       = body->mbo_uid;
                        st.st_gid       = body->mbo_gid;
                        st.st_rdev      = body->mbo_rdev;
                        st.st_size      = body->mbo_size;
                        st.st_blksize   = PAGE_CACHE_SIZE;
                        st.st_blocks    = body->mbo_blocks;
                        st.st_atime     = body->mbo_atime;
                        st.st_mtime     = body->mbo_mtime;
			st.st_ctime     = body->mbo_ctime;
                        st.st_ino       = inode->i_ino;

                        lmdp = (struct lov_user_mds_data __user *)arg;
                        if (copy_to_user(&lmdp->lmd_st, &st, sizeof(st)))
                                GOTO(out_req, rc = -EFAULT);
                }

We should always return the ino derived from the body.



 Comments   
Comment by akam kumar bharathi [ 11/Dec/15 ]

John,

struct inode *inode = file->f_path.dentry->d_inode;
.
.
...
st.st_ino>      = inode->i_ino;

> If the command is IOC_MDC_GETFILEINFO then ll_dir_ioctl() should be returning the ino derived from the body but is instead returning the ino of the parent.
where is the reference for parent coming from here ? Am i missing anything.

struct mdt_body *body;
...
 1398                 if (request) {
   1399                         body = req_capsule_server_get(&request->rq_pill,
   1400                                                       &RMF_MDT_BODY);

2199 struct mdt_body {
   2200 >       struct lu_fid mbo_fid1;
   2201 >       struct lu_fid mbo_fid2;
   2202 >       struct lustre_handle mbo_handle;
...

> We should always return the ino derived from the body.
I dont see any inode member in mdt_body. Is there any other way to extract it from body ? Please correct me if I am wrong.

Thanks

Comment by John Hammond [ 15/Dec/15 ]

This inode number is derived from the fid. See for example ll_update_inode():

        inode->i_ino = cl_fid_build_ino(&body->mbo_fid1,
                                        sbi->ll_flags & LL_SBI_32BIT_API);
Comment by Gerrit Updater [ 15/Dec/15 ]

akam kumar bharathi (azurelustre@gmail.com) uploaded a new patch: http://review.whamcloud.com/17618
Subject: LU-5954 IOC_MDC_GETFILEINFO returns the wrong ino
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 2197464707dfe6347ce2efd8947a18fde6f5fe9e

Comment by Gerrit Updater [ 14/Jun/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/17618/
Subject: LU-5954 IOC_MDC_GETFILEINFO returns the wrong ino
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 86158ae647b25338489bcb3181f29081f1d0368f

Comment by Joseph Gmitter (Inactive) [ 15/Jun/16 ]

patch has landed to master for 2.9.0

Generated at Sat Feb 10 01:55:57 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.