From: Lai Siyao Date: Sat, 12 Sep 2020 02:23:00 +0000 (+0800) Subject: LU-11631 obdclass: nlink is not set in struct obdo X-Git-Tag: 2.13.56~7 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a9ba4bca528938bf24ec1b172e03b24808393fb2;ds=sidebyside LU-11631 obdclass: nlink is not set in struct obdo 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 Change-Id: I2a8e6a7b3f98864ec11bca7f7c2070af90b64ade Reviewed-on: https://review.whamcloud.com/39896 Tested-by: jenkins Reviewed-by: Mike Pershin Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/obdclass/obdo_server.c b/lustre/obdclass/obdo_server.c index 0f7f474..75cb781 100644 --- a/lustre/obdclass/obdo_server.c +++ b/lustre/obdclass/obdo_server.c @@ -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; } + if (valid & LA_NLINK) { + dst->o_nlink = la->la_nlink; + newvalid |= OBD_MD_FLNLINK; + } 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; } + if (valid & OBD_MD_FLNLINK) { + dst->la_nlink = obdo->o_nlink; + newvalid |= LA_NLINK; + } dst->la_valid = newvalid; } EXPORT_SYMBOL(la_from_obdo);