[LU-4471] Failed 'rmdir' on remote directories still removes directory on MDT0 Created: 10/Jan/14 Updated: 01/Mar/14 Resolved: 25/Feb/14 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.5.0 |
| Fix Version/s: | Lustre 2.6.0, Lustre 2.5.1 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Patrick Farrell (Inactive) | Assignee: | Cliff White (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | MB, mn4, patch | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 12248 | ||||||||
| Description |
|
When doing an rmdir on a 'first level' remote directory, IE, a directory on MDT1 which is in a directory on MDT0, the directory entry on MDT0 is removed before the sanity checking is done. To reproduce (/lus/TEMP is a directory on MDT0): /lus/TEMP # mkdir mdt0 /lus/TEMP # lfs mkdir -i 1 mdt1 /lus/TEMP # touch mdt1/file /lus/TEMP # ls mdt0 mdt1 /lus/TEMP # ls mdt1 1 /lus/TEMP # rmdir mdt1 rmdir: failed to remove `mdt1': Directory not empty /lus/TEMP # ls mdt0 As you can see, rmdir returns with an error saying it failed to remove the directory mdt1, but the director no longer exists on MDT0. Looking at mdt_reint_unlink (which is executing on MDT1), it's easy to see why. if (mdt_object_remote(mc)) { struct mdt_body *repbody; if (!fid_is_zero(rr->rr_fid2)) { CDEBUG(D_INFO, "%s: name "DNAME" cannot find "DFID"\n", mdt_obd_name(info->mti_mdt), PNAME(&rr->rr_name), PFID(mdt_object_fid(mc))); GOTO(put_child, rc = -ENOENT); } CDEBUG(D_INFO, "%s: name "DNAME": "DFID" is on another MDT\n", mdt_obd_name(info->mti_mdt), PNAME(&rr->rr_name), PFID(mdt_object_fid(mc))); if (!mdt_is_dne_client(req->rq_export)) /* Return -EIO for old client */ GOTO(put_child, rc = -EIO); if (info->mti_spec.sp_rm_entry) { struct lu_ucred *uc = mdt_ucred(info); if (!md_capable(uc, CFS_CAP_SYS_ADMIN)) { CERROR("%s: unlink remote entry is only " "permitted for administrator: rc = %d\n", mdt_obd_name(info->mti_mdt), -EPERM); GOTO(put_child, rc = -EPERM); } ma->ma_need = MA_INODE; ma->ma_valid = 0; mdt_set_capainfo(info, 1, child_fid, BYPASS_CAPA); rc = mdo_unlink(info->mti_env, mdt_object_child(mp), NULL, &rr->rr_name, ma, no_name); GOTO(put_child, rc); } Followed shortly after by this: mutex_lock(&mc->mot_lov_mutex);
rc = mdo_unlink(info->mti_env, mdt_object_child(mp),
mdt_object_child(mc), &rr->rr_name, ma, no_name);
mutex_unlock(&mc->mot_lov_mutex);
It is mdo_unlink that returns the -39 (ENOTEMPTY) back to the client, because it calls mdd_unlink_sanity_check (which calls mdd_dir_is_empty). I have logs from both MDTs and the client of an rmdir on MDT0 failing as expected, and an rmdir on MDT1 showing the unusual behavior described. I'll attach those shortly. |
| Comments |
| Comment by Patrick Farrell (Inactive) [ 10/Jan/14 ] |
|
Logs of the client, MDS0, and MDS1 for: The 'normal' rmdir in these logs is the attempted removal of a directory on MDT0 with files in it, which fails as expected. The 'broken' rmdir in these logs is the attempted removal of a directory on MDT1, which returns a failure but also removes the directory entry for the directory on MDT0. Logs are from CentOS, Lustre is master from early January 2014. |
| Comment by Patrick Farrell (Inactive) [ 13/Jan/14 ] |
|
Ugh, my mistake here. The logs are still valid, but my analysis above was mistaken. The problem seems to be specifically in mdd_unlink. mdd_declare_unlink is called from mdd_unlink, and then when mdd_trans_start is called, the remote_sync it does causes the remote MDT to delete the directory. Further down, mdd_unlink_sanity_check is called on the non-remote MDT, and it errors because the directory is non-empty. |
| Comment by Patrick Farrell (Inactive) [ 13/Jan/14 ] |
|
Patch here: Confirmed it fixes the issue in question. |
| Comment by Cliff White (Inactive) [ 14/Jan/14 ] |
|
Thanks, will monitor. |
| Comment by Jodi Levi (Inactive) [ 20/Jan/14 ] |
|
Cliff, |
| Comment by Cliff White (Inactive) [ 20/Jan/14 ] |
|
Patrick, it appears that you patch has failed some reviews, are you able to address the comments? |
| Comment by Patrick Farrell (Inactive) [ 20/Jan/14 ] |
|
Cliff - Most definitely. Barring the unexpected, I'll get to fixing it up this afternoon. |
| Comment by Cliff White (Inactive) [ 06/Feb/14 ] |
|
Patrick, any updates on this issue? |
| Comment by Patrick Farrell (Inactive) [ 06/Feb/14 ] |
|
Cliff - Not really. This one's in Intel's hands now. My patch, I think, satisfies Andreas and Fan Yong, and Cray has been using it internally for a bit now with great success. The Maloo tests failed for a reason unrelated to my patch, and need to be re-run. I can't really do anything more, as the patch is good - Someone at Intel can restart the Maloo testing, and hopefully it won't hit any other issues. |
| Comment by Cliff White (Inactive) [ 10/Feb/14 ] |
|
I have restarted testing, sorry about that. Will monitor. |
| Comment by Bob Glossman (Inactive) [ 25/Feb/14 ] |
|
backport to b2_5: |
| Comment by Peter Jones [ 25/Feb/14 ] |
|
Landed for 2.6 |