xfs
[Top] [All Lists]

[PATCH 06/11] xfs: take the ilock around xfs_bmapi_read in xfs_zero_rema

To: xfs@xxxxxxxxxxx
Subject: [PATCH 06/11] xfs: take the ilock around xfs_bmapi_read in xfs_zero_remaining_bytes
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 06 Dec 2013 12:30:12 -0800
Delivered-to: xfs@xxxxxxxxxxx
References: <20131206203006.914776999@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.60-1
Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfs/fs/xfs/xfs_bmap_util.c
===================================================================
--- xfs.orig/fs/xfs/xfs_bmap_util.c     2013-12-06 19:37:36.715162723 +0100
+++ xfs/fs/xfs/xfs_bmap_util.c  2013-12-06 19:38:45.643161309 +0100
@@ -1175,9 +1175,15 @@ xfs_zero_remaining_bytes(
        xfs_buf_unlock(bp);
 
        for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
+               uint lock_mode;
+
                offset_fsb = XFS_B_TO_FSBT(mp, offset);
                nimap = 1;
+
+               lock_mode = xfs_ilock_data_map_shared(ip);
                error = xfs_bmapi_read(ip, offset_fsb, 1, &imap, &nimap, 0);
+               xfs_iunlock(ip, lock_mode);
+
                if (error || nimap < 1)
                        break;
                ASSERT(imap.br_blockcount >= 1);

<Prev in Thread] Current Thread [Next in Thread>