diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-12-19 22:07:58 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-13 12:07:11 +0300 |
commit | b7c6fd47260a9673822032f2091363b49cd6c8ca (patch) | |
tree | 75f711d764c232ca65b21b77cc6f09cff949ff0b /fs/ext4 | |
parent | cf161cde3d8e227a6b6b54cfda853f6a412bc71e (diff) | |
download | linux-b7c6fd47260a9673822032f2091363b49cd6c8ca.tar.xz |
ext4: force inode writes when nfsd calls commit_metadata()
commit fde872682e175743e0c3ef939c89e3c6008a1529 upstream.
Some time back, nfsd switched from calling vfs_fsync() to using a new
commit_metadata() hook in export_operations(). If the file system did
not provide a commit_metadata() hook, it fell back to using
sync_inode_metadata(). Unfortunately doesn't work on all file
systems. In particular, it doesn't work on ext4 due to how the inode
gets journalled --- the VFS writeback code will not always call
ext4_write_inode().
So we need to provide our own ext4_nfs_commit_metdata() method which
calls ext4_write_inode() directly.
Google-Bug-Id: 121195940
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/super.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 0aa7c5250f87..f0bdddc26c99 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1034,6 +1034,16 @@ static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid, ext4_nfs_get_inode); } +static int ext4_nfs_commit_metadata(struct inode *inode) +{ + struct writeback_control wbc = { + .sync_mode = WB_SYNC_ALL + }; + + trace_ext4_nfs_commit_metadata(inode); + return ext4_write_inode(inode, &wbc); +} + /* * Try to release metadata pages (indirect blocks, directories) which are * mapped via the block device. Since these pages could have journal heads @@ -1135,6 +1145,7 @@ static const struct export_operations ext4_export_ops = { .fh_to_dentry = ext4_fh_to_dentry, .fh_to_parent = ext4_fh_to_parent, .get_parent = ext4_get_parent, + .commit_metadata = ext4_nfs_commit_metadata, }; enum { |