Whamcloud - gitweb
LU-15800 ofd: take a read lock for fallocate 68/47268/5
authorAlex Zhuravlev <bzzz@whamcloud.com>
Tue, 10 May 2022 07:48:55 +0000 (10:48 +0300)
committerOleg Drokin <green@whamcloud.com>
Mon, 6 Jun 2022 06:27:05 +0000 (06:27 +0000)
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.

Fixes: cdaaa87f6b ("LU-14214 ofd: fix locking in ofd_object_fallocate()")
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I65986745865ee329c5257a7efca5e79403830608
Reviewed-on: https://review.whamcloud.com/47268
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ofd/ofd_objects.c

index 9fd41e8..2c55d0f 100644 (file)
@@ -824,7 +824,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);
 
@@ -847,7 +847,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);