Whamcloud - gitweb
LU-11631 obdclass: nlink is not set in struct obdo 96/39896/2
authorLai Siyao <lai.siyao@whamcloud.com>
Sat, 12 Sep 2020 02:23:00 +0000 (10:23 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 25 Sep 2020 03:12:53 +0000 (03:12 +0000)
Traditionally the nlink field is not set in obdo_from_la() and vice
versa, because it's used for communication between MDT and OST, and
this field is not used, but when DNE is enabled, this function is
used to getattr between MDTs, which will always see zero nlink.

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I2a8e6a7b3f98864ec11bca7f7c2070af90b64ade
Reviewed-on: https://review.whamcloud.com/39896
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/obdclass/obdo_server.c

index 0f7f474..75cb781 100644 (file)
@@ -94,6 +94,10 @@ void obdo_from_la(struct obdo *dst, const struct lu_attr *la, u64 valid)
                dst->o_flags = la->la_flags;
                newvalid |= OBD_MD_FLFLAGS;
        }
                dst->o_flags = la->la_flags;
                newvalid |= OBD_MD_FLFLAGS;
        }
+       if (valid & LA_NLINK) {
+               dst->o_nlink = la->la_nlink;
+               newvalid |= OBD_MD_FLNLINK;
+       }
        dst->o_valid |= newvalid;
 }
 EXPORT_SYMBOL(obdo_from_la);
        dst->o_valid |= newvalid;
 }
 EXPORT_SYMBOL(obdo_from_la);
@@ -151,6 +155,10 @@ void la_from_obdo(struct lu_attr *dst, const struct obdo *obdo, u64 valid)
                dst->la_flags = obdo->o_flags;
                newvalid |= LA_FLAGS;
        }
                dst->la_flags = obdo->o_flags;
                newvalid |= LA_FLAGS;
        }
+       if (valid & OBD_MD_FLNLINK) {
+               dst->la_nlink = obdo->o_nlink;
+               newvalid |= LA_NLINK;
+       }
        dst->la_valid = newvalid;
 }
 EXPORT_SYMBOL(la_from_obdo);
        dst->la_valid = newvalid;
 }
 EXPORT_SYMBOL(la_from_obdo);