From: alex Date: Sun, 7 Aug 2005 16:53:26 +0000 (+0000) Subject: - mds_validate_size() vs. mds_reint_unlink() race is absolutely legal X-Git-Tag: v1_7_100~967 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7f4fb5c428cba1ddcb42a41f80b48fe0b9b5d2ca;p=fs%2Flustre-release.git - mds_validate_size() vs. mds_reint_unlink() race is absolutely legal --- diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index f49a66a..ad4f02c 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1647,7 +1647,8 @@ out: rc = 0; if (!obd->obd_recovering && mds_inode_has_old_attrs(inode) && !mds_inode_is_orphan(inode) - && atomic_read(&inode->i_writecount) == 0) { + && atomic_read(&inode->i_writecount) == 0 + && inode->i_nlink != 0) { CERROR("leave inode %lu/%u with old attributes (nlink = %d)\n", inode->i_ino, inode->i_generation, inode->i_nlink); } @@ -1780,7 +1781,12 @@ int mds_validate_size(struct obd_device *obd, struct inode *inode, LCK_PR, &flags, mds_extent_lock_callback, ldlm_completion_ast, NULL, NULL, sizeof(struct ost_lvb), lustre_swab_ost_lvb, &lockh); - if (rc != 0) { + if (rc == -ENOENT) { + /* while we were enqueueing lock on OST, another thread + * unlinked the file and started OST object destoying. + * it's safe to return 0 here */ + GOTO(cleanup, rc = 0); + } else if (rc != 0) { CERROR("obd_enqueue returned rc %d, returning -EIO\n", rc); GOTO(cleanup, rc); } diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index e65706e..5b7928d 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1369,7 +1369,7 @@ static int filter_intent_policy(struct ldlm_namespace *ns, if (l->l_glimpse_ast == NULL) { /* We are racing with unlink(); just return -ENOENT */ - CDEBUG(D_ERROR, "race with unlink: "LPX64"/"LPX64"\n", + CDEBUG(D_OTHER, "race with unlink: "LPX64"/"LPX64"\n", res->lr_name.name[0], res->lr_name.name[2]); rep->lock_policy_res1 = -ENOENT; goto out;