Skip to content

Commit 4c0e8dd

Browse files
Christoph HellwigAndreas Gruenbacher
authored andcommitted
gfs2: move setting current->backing_dev_info
Set current->backing_dev_info just around the buffered write calls to prepare for the next fix. Fixes: 967bcc9 ("gfs2: iomap direct I/O support") Cc: [email protected] # v4.19+ Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 7582026 commit 4c0e8dd

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

fs/gfs2/file.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -867,18 +867,15 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
867867
inode_lock(inode);
868868
ret = generic_write_checks(iocb, from);
869869
if (ret <= 0)
870-
goto out;
871-
872-
/* We can write back this queue in page reclaim */
873-
current->backing_dev_info = inode_to_bdi(inode);
870+
goto out_unlock;
874871

875872
ret = file_remove_privs(file);
876873
if (ret)
877-
goto out2;
874+
goto out_unlock;
878875

879876
ret = file_update_time(file);
880877
if (ret)
881-
goto out2;
878+
goto out_unlock;
882879

883880
if (iocb->ki_flags & IOCB_DIRECT) {
884881
struct address_space *mapping = file->f_mapping;
@@ -887,11 +884,13 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
887884

888885
written = gfs2_file_direct_write(iocb, from);
889886
if (written < 0 || !iov_iter_count(from))
890-
goto out2;
887+
goto out_unlock;
891888

889+
current->backing_dev_info = inode_to_bdi(inode);
892890
ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
891+
current->backing_dev_info = NULL;
893892
if (unlikely(ret < 0))
894-
goto out2;
893+
goto out_unlock;
895894
buffered = ret;
896895

897896
/*
@@ -915,14 +914,14 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
915914
*/
916915
}
917916
} else {
917+
current->backing_dev_info = inode_to_bdi(inode);
918918
ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
919+
current->backing_dev_info = NULL;
919920
if (likely(ret > 0))
920921
iocb->ki_pos += ret;
921922
}
922923

923-
out2:
924-
current->backing_dev_info = NULL;
925-
out:
924+
out_unlock:
926925
inode_unlock(inode);
927926
if (likely(ret > 0)) {
928927
/* Handle various SYNC-type writes */

0 commit comments

Comments
 (0)