Whamcloud - gitweb
LU-15779 ofd: don't hold read lock over bulk 26/47126/5
authorAlex Zhuravlev <bzzz@whamcloud.com>
Sun, 24 Apr 2022 11:27:18 +0000 (14:27 +0300)
committerOleg Drokin <green@whamcloud.com>
Mon, 11 Jul 2022 22:30:45 +0000 (22:30 +0000)
as this can block all operations on OST:

1) ofd_preprw_read() takes a shared object lock and initiates BULK
2) OUT needs an exclusive object lock on the same object
3) ofd_commitrw_write() starts transaction and now has to wait
   for OUT to get and release that exclusive object lock (step 2)
4) number of threads can get stuck waiting for ofd_commit_write()
   to stop it's transaction

this patch drops a shared object lock before BULK transfer.
at the moment it's not clear how such read would race with
object removal on ZFS - this should be investigated.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I131493abd90283e9ca897f904e00c25d26e3d8d3
Reviewed-on: https://review.whamcloud.com/47126
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ofd/ofd_io.c

index 6e9a87b..e6c8991 100644 (file)
@@ -631,6 +631,7 @@ static int ofd_preprw_read(const struct lu_env *env, struct obd_export *exp,
        rc = dt_read_prep(env, ofd_object_child(fo), lnb, *nr_local);
        if (unlikely(rc))
                GOTO(buf_put, rc);
+       ofd_read_unlock(env, fo);
 
        ofd_access(env, ofd,
                &(struct lu_fid) {
@@ -993,7 +994,6 @@ ofd_commitrw_read(const struct lu_env *env, struct ofd_device *ofd,
        LASSERT(ofd_object_exists(fo));
        dt_bufs_put(env, ofd_object_child(fo), lnb, niocount);
 
-       ofd_read_unlock(env, fo);
        ofd_object_put(env, fo);
 
        RETURN(0);