[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio_pcs: add assert on i_mutex for PUNCH_HOLE and ZERO_RANGE

Konstantin Khorenko khorenko at virtuozzo.com
Thu Nov 8 17:28:10 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.20.2.vz7.73.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.20.2.vz7.73.2
------>
commit 85e7860fc38b2c8db1220f676860545e7ee60361
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Thu Nov 8 17:28:07 2018 +0300

    fs/fuse kio_pcs: add assert on i_mutex for PUNCH_HOLE and ZERO_RANGE
    
    PUNCH_HOLE and ZERO_RANGE operations must be performed only under i_mutex.
    
    https://pmc.acronis.com/browse/VSTOR-16876
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 3940d6c255ba..a0225de80c0e 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -944,6 +944,8 @@ static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, struct fuse_req *req,
 			inarg->mode &= ~FALLOC_FL_ZERO_RANGE;
 
 		if (inarg->mode & (FALLOC_FL_ZERO_RANGE|FALLOC_FL_PUNCH_HOLE)) {
+			WARN_ON_ONCE(!mutex_is_locked(&fi->inode.i_mutex));
+
 			if ((inarg->offset & (PAGE_SIZE - 1)) || (inarg->length & (PAGE_SIZE - 1))) {
 				r->req.out.h.error = -EINVAL;
 				goto error;



More information about the Devel mailing list