If the directory is created before 2.0, there are no LMA
for the directory, then osd_delete_from_remote_parent()
will return ENODATA. So we should ignore ENODATA in this
case otherwise it will cause unlink fails.
Lustre-commit:
860283cb433dff4246a5c255ed89325323ee8e7c
Lustre-change: http://review.whamcloud.com/16760
Signed-off-by: Wang Di <di.wang@intel.com>
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Intel-bug-id: LDEV-64
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Change-Id: I728c081f324253080c5d2cb740b3a11b26f9d570
Reviewed-on: http://review.whamcloud.com/23030
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
/* Check lma to see whether it is remote object */
rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry, lma);
/* Check lma to see whether it is remote object */
rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry, lma);
+ if (rc != 0) {
+ /* No LMA if the directory is created before 2.0 */
+ if (rc == -ENODATA)
+ rc = 0;
if (likely(!(lma->lma_incompat & LMAI_REMOTE_PARENT)))
RETURN(0);
if (likely(!(lma->lma_incompat & LMAI_REMOTE_PARENT)))
RETURN(0);
/* it will check/delete the inode from remote parent,
* how to optimize it? unlink performance impaction XXX */
result = osd_delete_from_remote_parent(env, osd, obj, oh);
/* it will check/delete the inode from remote parent,
* how to optimize it? unlink performance impaction XXX */
result = osd_delete_from_remote_parent(env, osd, obj, oh);
- if (result != 0 && result != -ENOENT) {
CERROR("%s: delete inode "DFID": rc = %d\n",
osd_name(osd), PFID(fid), result);
CERROR("%s: delete inode "DFID": rc = %d\n",
osd_name(osd), PFID(fid), result);
spin_lock(&obj->oo_guard);
clear_nlink(inode);
spin_unlock(&obj->oo_guard);
spin_lock(&obj->oo_guard);
clear_nlink(inode);
spin_unlock(&obj->oo_guard);
* /Agent directory, Check whether it needs to delete
* from agent directory */
if (unlikely(strcmp((char *)key, dotdot) == 0)) {
* /Agent directory, Check whether it needs to delete
* from agent directory */
if (unlikely(strcmp((char *)key, dotdot) == 0)) {
- rc = osd_delete_from_remote_parent(env, osd_obj2dev(obj), obj,
- oh);
- if (rc != 0 && rc != -ENOENT) {
- CERROR("%s: delete agent inode "DFID": rc = %d\n",
- osd_name(osd), PFID(fid), rc);
- }
-
- if (rc == -ENOENT)
- rc = 0;
-
- GOTO(out, rc);
+ int ret;
+
+ ret = osd_delete_from_remote_parent(env, osd_obj2dev(obj),
+ obj, oh);
+ if (ret != 0)
+ /* Sigh, the entry has been deleted, and
+ * it is not easy to revert it back, so
+ * let's keep this error private, and let
+ * LFSCK fix it. XXX */
+ CERROR("%s: delete remote parent "DFID": rc = %d\n",
+ osd_name(osd), PFID(fid), ret);
LASSERT(osd_invariant(obj));
osd_trans_exec_check(env, handle, OSD_OT_DELETE);
RETURN(rc);
LASSERT(osd_invariant(obj));
osd_trans_exec_check(env, handle, OSD_OT_DELETE);
RETURN(rc);