From c1770567350f479ff4014a94a4d5411c41de0dc3 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 28 Apr 2014 20:57:53 -0400 Subject: [PATCH 1/1] LU-4008 mdt: update mdt_getattr comments about EA sizing After landing previous patches, some comments became out of date This patch tries to rectify the situation and also adds some additional explanations. Change-Id: Ic3fb33ec60f7ae083ecae84cd207d2c10b95f965 Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/10141 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Mike Pershin --- lustre/mdt/mdt_handler.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 66c60ee..ccbf2a9 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1078,6 +1078,10 @@ static int mdt_getattr(struct tgt_session_info *tsi) LASSERT(obj != NULL); LASSERT(lu_object_assert_exists(&obj->mot_obj)); + /* Unlike intent case where we need to pre-fill out buffers early on + * in intent policy for ldlm reasons, here we can have a much better + * guess at EA size by just reading it from disk. + * Exceptions are readdir and (missing) directory striping */ /* Readlink */ if (reqbody->valid & OBD_MD_LINKNAME) { /* No easy way to know how long is the symlink, but it cannot @@ -1096,15 +1100,13 @@ static int mdt_getattr(struct tgt_session_info *tsi) * will reallocate */ rc = DEF_REP_MD_SIZE; } else { - /* Hopefully no race in EA change for either file or directory? - */ + /* Read the actual EA size from disk */ rc = mdt_attr_get_eabuf_size(info, obj); } if (rc < 0) GOTO(out_shrink, rc); - /* old clients may not report needed easize, use max value then */ req_capsule_set_size(pill, &RMF_MDT_MD, RCL_SERVER, rc); rc = req_capsule_server_pack(pill); -- 1.8.3.1