[PATCH 2/2] xfs: shortcut xfs_file_release for read-only file descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
 	
 	if (XFS_FORCED_SHUTDOWN(mp))
-- 
2.20.1




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux