From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 2/2] xfs: shortcut xfs_file_release for read-only file descriptors
Date: Mon, 16 Sep 2019 14:20:41 +0200 [thread overview]
Message-ID: <20190916122041.24636-3-hch@lst.de> (raw)
In-Reply-To: <20190916122041.24636-1-hch@lst.de>
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@lst.de>
---
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
next prev parent reply other threads:[~2019-09-16 12:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-16 12:20 minor ->release fixups and cleanups Christoph Hellwig
2019-09-16 12:20 ` [PATCH 1/2] xfs: remove xfs_release Christoph Hellwig
2019-09-16 12:53 ` Brian Foster
2019-09-18 16:49 ` Christoph Hellwig
2019-09-18 18:12 ` Brian Foster
2019-09-18 18:21 ` Darrick J. Wong
2019-09-18 22:25 ` Dave Chinner
2019-09-16 12:20 ` Christoph Hellwig [this message]
2019-09-16 12:53 ` [PATCH 2/2] xfs: shortcut xfs_file_release for read-only file descriptors Brian Foster
2019-09-18 16:50 ` Christoph Hellwig
2019-09-18 17:06 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190916122041.24636-3-hch@lst.de \
--to=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox