[LU-8579] oti_dev is never set, but is used Created: 02/Sep/16  Updated: 29/Sep/16  Resolved: 29/Sep/16

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

Type: Bug Priority: Minor
Reporter: Andreas Dilger Assignee: nasf (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Attachments: File remove-oti_dev.diff    
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

The oti_dev member of osd_thread_info is never set, but is used in a check:

int osd_ldiskfs_add_entry(struct osd_thread_info *info,
                          handle_t *handle, struct dentry *child,
                          struct inode *inode, struct htree_lock *hlock)
{
        rc = __ldiskfs_add_entry(handle, child, inode, hlock);
        if (rc == -ENOBUFS || rc == -ENOSPC) {
                struct lu_fid fid = { };
                :
                :
                rc2 = osd_get_lma(info, p_dentry->d_inode, p_dentry, &lma);
                if (rc2 == 0) {
                        fid = lma.lma_self_fid;
                        snprintf(fidbuf, sizeof(fidbuf), DFID, PFID(&fid));
                } else if (rc2 == -ENODATA) {
                        if (unlikely(p_dentry->d_inode ==
                                     inode->i_sb->s_root->d_inode))
                                lu_local_obj_fid(&fid, OSD_FS_ROOT_OID);
                        else if (info->oti_dev && !info->oti_dev->od_is_ost &&
                                 fid_seq_is_mdt0(fid_seq(&fid)))
                                lu_igif_build(&fid, p_dentry->d_inode->i_ino,
                                              p_dentry->d_inode->i_generation);
                        snprintf(fidbuf, sizeof(fidbuf), DFID, PFID(&fid));

Because oti_dev is initialized to NULL, then the info->oti_dev check will always fail, and od_is_ost can not be verified.

Also, the fid_seq_is_mdt0(fid_seq(&fid)) check is always true, because fid.f_seq is initialized to zero at the start of the function and never changed in this codepath.

Is this just dead code and should be removed, or should something else be done to fix this bit of code?



 Comments   
Comment by Andreas Dilger [ 02/Sep/16 ]

Attached is the part of http://review.whamcloud.com/19865 that related to this issue that can be used when fixing this issue.

Comment by Gerrit Updater [ 04/Sep/16 ]

Fan Yong (fan.yong@intel.com) uploaded a new patch: http://review.whamcloud.com/22307
Subject: LU-8579 osd-ldiskfs: code cleanup for osd_ldiskfs_add_entry
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 8c0f67871bea7f74dd1ca24e5e6079da8a6b3915

Comment by Gerrit Updater [ 29/Sep/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/22307/
Subject: LU-8579 osd-ldiskfs: code cleanup for osd_ldiskfs_add_entry
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 3ed0a4a64642751931fcc397511c4a118e3d1a51

Generated at Sat Feb 10 02:18:47 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.