Message ID | 20190911164517.16130-2-rgoldwyn@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] btrfs: fix inode rwsem regression | expand |
On Wed, Sep 11, 2019 at 11:45:15AM -0500, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@suse.com> > > This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression") > Apparently our current rwsem code doesn't like doing the trylock, then > lock for real scheme. So change our read/write methods to just do the > trylock for the RWF_NOWAIT case. > > Fixes: edf064e7c6fe ("btrfs: nowait aio support") > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> The subject seems to be a bit confusing so I'll update it, otherwise patch added to devel queue, thanks.
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 58a18ed11546..651b2b1f4219 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1893,9 +1893,10 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, (iocb->ki_flags & IOCB_NOWAIT)) return -EOPNOTSUPP; - if (!inode_trylock(inode)) { - if (iocb->ki_flags & IOCB_NOWAIT) + if (iocb->ki_flags & IOCB_NOWAIT) { + if (!inode_trylock(inode)) return -EAGAIN; + } else { inode_lock(inode); }