From 8299b3fd77ebcc372b5d929eaa08231fc703c431 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Tue, 10 May 2022 10:48:55 +0300 Subject: [PATCH] LU-15800 ofd: take a read lock for fallocate there is no need to take an write (exclusive) object's lock for fallocate - we just need to serialize fallocate vs destroy, all internal structures should be protected by OSD and disk filesystem like the write path does. Lustre-change: https://review.whamcloud.com/47268 Lustre-commit: 5fae80066162ea637c8649f6439fc14e1d9a7cf8 Fixes: cdaaa87f6b ("LU-14214 ofd: fix locking in ofd_object_fallocate()") Signed-off-by: Alex Zhuravlev Change-Id: I65986745865ee329c5257a7efca5e79403830608 Reviewed-by: Arshad Hussain Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51702 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/ofd/ofd_objects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index 41fe74b..16f9fba 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -801,7 +801,7 @@ int ofd_object_fallocate(const struct lu_env *env, struct ofd_object *fo, if (rc) GOTO(stop, rc); - ofd_write_lock(env, fo); + ofd_read_lock(env, fo); if (!ofd_object_exists(fo)) GOTO(unlock, rc = -ENOENT); @@ -824,7 +824,7 @@ int ofd_object_fallocate(const struct lu_env *env, struct ofd_object *fo, filter_fid_le_to_cpu(&fo->ofo_ff, ff, sizeof(*ff)); } unlock: - ofd_write_unlock(env, fo); + ofd_read_unlock(env, fo); stop: ofd_trans_stop(env, ofd, th, rc); RETURN(rc); -- 1.8.3.1