diff options
author | Christoph Hellwig <hch@lst.de> | 2020-01-15 16:38:29 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-02-11 04:34:07 -0800 |
commit | e57e77e9321c453f220fdd19a24669c2a58a53be (patch) | |
tree | f565094eaf556c67cf37361dec95af6b5572dac7 /fs | |
parent | a90c2c5e8c01c50b6ba026742d0bfd3299b42d26 (diff) | |
download | linux-stable-e57e77e9321c453f220fdd19a24669c2a58a53be.tar.gz linux-stable-e57e77e9321c453f220fdd19a24669c2a58a53be.tar.bz2 linux-stable-e57e77e9321c453f220fdd19a24669c2a58a53be.zip |
gfs2: move setting current->backing_dev_info
commit 4c0e8dda608a51855225c611b5c6b442f95fbc56 upstream.
Set current->backing_dev_info just around the buffered write calls to
prepare for the next fix.
Fixes: 967bcc91b044 ("gfs2: iomap direct I/O support")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/file.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 08369c6cd127..db932576acfc 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -800,18 +800,15 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from) inode_lock(inode); ret = generic_write_checks(iocb, from); if (ret <= 0) - goto out; - - /* We can write back this queue in page reclaim */ - current->backing_dev_info = inode_to_bdi(inode); + goto out_unlock; ret = file_remove_privs(file); if (ret) - goto out2; + goto out_unlock; ret = file_update_time(file); if (ret) - goto out2; + goto out_unlock; if (iocb->ki_flags & IOCB_DIRECT) { struct address_space *mapping = file->f_mapping; @@ -820,11 +817,13 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from) written = gfs2_file_direct_write(iocb, from); if (written < 0 || !iov_iter_count(from)) - goto out2; + goto out_unlock; + current->backing_dev_info = inode_to_bdi(inode); ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops); + current->backing_dev_info = NULL; if (unlikely(ret < 0)) - goto out2; + goto out_unlock; buffered = ret; /* @@ -848,14 +847,14 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from) */ } } else { + current->backing_dev_info = inode_to_bdi(inode); ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops); + current->backing_dev_info = NULL; if (likely(ret > 0)) iocb->ki_pos += ret; } -out2: - current->backing_dev_info = NULL; -out: +out_unlock: inode_unlock(inode); if (likely(ret > 0)) { /* Handle various SYNC-type writes */ |