Re: [PATCH][RESEND] vfs: serialize updates to file->f_sb_err with f_lock

2021-01-04 Thread Jeff Layton
On Mon, 2021-01-04 at 18:57 +, Al Viro wrote: > On Mon, Jan 04, 2021 at 01:43:47PM -0500, Jeff Layton wrote: > > @@ -172,7 +172,12 @@ SYSCALL_DEFINE1(syncfs, int, fd) > >   ret = sync_filesystem(sb); > >   up_read(&sb->s_umount); > >   > > > > - ret2 = errseq_check_and_advance(&sb->s_wb_

Re: [PATCH][RESEND] vfs: serialize updates to file->f_sb_err with f_lock

2021-01-04 Thread Al Viro
On Mon, Jan 04, 2021 at 01:43:47PM -0500, Jeff Layton wrote: > @@ -172,7 +172,12 @@ SYSCALL_DEFINE1(syncfs, int, fd) > ret = sync_filesystem(sb); > up_read(&sb->s_umount); > > - ret2 = errseq_check_and_advance(&sb->s_wb_err, &f.file->f_sb_err); > + if (errseq_check(&sb->s_wb_e

[PATCH][RESEND] vfs: serialize updates to file->f_sb_err with f_lock

2021-01-04 Thread Jeff Layton
When I added the ability for syncfs to report writeback errors, I neglected to adequately protect file->f_sb_err. While changes to sb->s_wb_err don't require locking, we do need to protect the errseq_t cursor in file->f_sb_err. We could have racing updates to that value if two tasks are issuing sy