On Mon, Sep 16, 2019 at 02:20:41PM +0200, Christoph Hellwig wrote: > xfs_file_release currently performs flushing of truncated blocks and > freeing of the post-EOF speculative preallocation for all file > descriptors as long as they are not on a read-only mount. Switch to > check for FMODE_WRITE instead as we should only perform these actions > on writable file descriptors, and no such file descriptors can be > created on a read-only mount. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > fs/xfs/xfs_file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c > index 72680edf2ceb..06f0eb25c7cc 100644 > --- a/fs/xfs/xfs_file.c > +++ b/fs/xfs/xfs_file.c > @@ -1066,7 +1066,7 @@ xfs_file_release( > struct xfs_inode *ip = XFS_I(inode); > struct xfs_mount *mp = ip->i_mount; > > - if (mp->m_flags & XFS_MOUNT_RDONLY) > + if (!(file->f_mode & FMODE_WRITE)) > return 0; > Didn't Dave have a variant of this patch for dealing with a fragmentation issue (IIRC)? Anyways, seems fine: Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> > if (XFS_FORCED_SHUTDOWN(mp)) > -- > 2.20.1 >