From: alex Date: Thu, 7 Jul 2005 14:23:22 +0000 (+0000) Subject: b=6285 X-Git-Tag: 1.4.10~922 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=70880ac14cffcf851a9c33afc8c0d7988d69b80a;p=fs%2Flustre-release.git b=6285 - sometimes mds_getattr_lock() is asked to refresh attributes by fid. it doesn't take LOOKUP lock, thus has no protected from concurrent unlink. this means mds_getattr_lock() can return already unlinked (and being removed) inode. to avoid this we check i_nlink right after we got UPDATE lock and return -ENOENT if nlink is zero --- diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 77c4b23..e4b4681 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -292,6 +292,20 @@ struct dentry *mds_id2locked_dentry(struct obd_device *obd, struct lustre_id *id if (lockh[1].cookie) ldlm_lock_decref(lockh + 1, *mode); #endif + } if (de->d_inode && de->d_inode->i_nlink == 0) { + /* as sometimes we lookup inode by ino/generation through + iopen mechanism, it's possible to find already unlinked + inode with nlink == 0. let's interpretate the case as + ENOENT -bzzz */ + CWARN("found already unlinked inode %lu/%u\n", + de->d_inode->i_ino, de->d_inode->i_generation); + l_dput(de); + retval = ERR_PTR(-ENOENT); + ldlm_lock_decref(lockh, lock_mode); +#ifdef S_PDIROPS + if (lockh[1].cookie) + ldlm_lock_decref(lockh + 1, *mode); +#endif } RETURN(retval);