xfs
[Top] [All Lists]

[PATCH] xfs: lock bitmap/summary inodes in xfs_rtbuf_get()

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfs: lock bitmap/summary inodes in xfs_rtbuf_get()
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Fri, 29 Jan 2016 21:26:28 -0600
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1
Commit eef334e added an ASSERT that the inode was locked in
some way in xfs_bmapi_read(), but on realtime paths through
xfs_rtbuf_get() this isn't the case; fix that.

Reported-by: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

I think we need the data_map_shared gyrations here, but not certain...

diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c
index 9b59ffa..e6da0b2 100644
--- a/fs/xfs/libxfs/xfs_rtbitmap.c
+++ b/fs/xfs/libxfs/xfs_rtbitmap.c
@@ -57,11 +57,14 @@ xfs_rtbuf_get(
        xfs_inode_t     *ip;            /* bitmap or summary inode */
        xfs_bmbt_irec_t map;
        int             nmap = 1;
+       int             lock_mode;
        int             error;          /* error value */
 
        ip = issum ? mp->m_rsumip : mp->m_rbmip;
 
+       lock_mode = xfs_ilock_data_map_shared(ip);
        error = xfs_bmapi_read(ip, block, 1, &map, &nmap, XFS_DATA_FORK);
+       xfs_iunlock(ip, lock_mode);
        if (error)
                return error;
 

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