From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 13/17] gfs2: Fix xattr fsync
Date: Mon, 13 Nov 2017 08:35:58 -0600 [thread overview]
Message-ID: <20171113143602.1319-14-rpeterso@redhat.com> (raw)
In-Reply-To: <20171113143602.1319-1-rpeterso@redhat.com>
From: Andreas Gruenbacher <agruenba@redhat.com>
Make sure that changing xattrs marks the corresponding inode dirty so
that a subsequent fsync will sync those changes to disk. We set
I_DIRTY_SYNC as well as I_DIRTY_DATASYNC so that both fsync and
fdatasync will sync xattr changes: xattrs can contain information
critical to how the data can be accessed, so we don't want fdatasync
to skip them.
Fixes xfstest generic/066.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/xattr.c | 40 ++++++++--------------------------------
1 file changed, 8 insertions(+), 32 deletions(-)
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index ea09e41dbb49..3e96dce21c1c 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -231,7 +231,6 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_rgrpd *rgd;
struct gfs2_holder rg_gh;
- struct buffer_head *dibh;
__be64 *dataptrs;
u64 bn = 0;
u64 bstart = 0;
@@ -308,13 +307,8 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
ea->ea_num_ptrs = 0;
}
- error = gfs2_meta_inode_buffer(ip, &dibh);
- if (!error) {
- ip->i_inode.i_ctime = current_time(&ip->i_inode);
- gfs2_trans_add_meta(ip->i_gl, dibh);
- gfs2_dinode_out(ip, dibh->b_data);
- brelse(dibh);
- }
+ ip->i_inode.i_ctime = current_time(&ip->i_inode);
+ __mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC);
gfs2_trans_end(sdp);
@@ -749,7 +743,6 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
ea_skeleton_call_t skeleton_call, void *private)
{
struct gfs2_alloc_parms ap = { .target = blks };
- struct buffer_head *dibh;
int error;
error = gfs2_rindex_update(GFS2_SB(&ip->i_inode));
@@ -774,13 +767,8 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
if (error)
goto out_end_trans;
- error = gfs2_meta_inode_buffer(ip, &dibh);
- if (!error) {
- ip->i_inode.i_ctime = current_time(&ip->i_inode);
- gfs2_trans_add_meta(ip->i_gl, dibh);
- gfs2_dinode_out(ip, dibh->b_data);
- brelse(dibh);
- }
+ ip->i_inode.i_ctime = current_time(&ip->i_inode);
+ __mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC);
out_end_trans:
gfs2_trans_end(GFS2_SB(&ip->i_inode));
@@ -891,7 +879,6 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
struct gfs2_ea_header *ea, struct ea_set *es)
{
struct gfs2_ea_request *er = es->es_er;
- struct buffer_head *dibh;
int error;
error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + 2 * RES_EATTR, 0);
@@ -908,14 +895,9 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
if (es->es_el)
ea_set_remove_stuffed(ip, es->es_el);
- error = gfs2_meta_inode_buffer(ip, &dibh);
- if (error)
- goto out;
ip->i_inode.i_ctime = current_time(&ip->i_inode);
- gfs2_trans_add_meta(ip->i_gl, dibh);
- gfs2_dinode_out(ip, dibh->b_data);
- brelse(dibh);
-out:
+ __mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC);
+
gfs2_trans_end(GFS2_SB(&ip->i_inode));
return error;
}
@@ -1111,7 +1093,6 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
{
struct gfs2_ea_header *ea = el->el_ea;
struct gfs2_ea_header *prev = el->el_prev;
- struct buffer_head *dibh;
int error;
error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0);
@@ -1132,13 +1113,8 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
ea->ea_type = GFS2_EATYPE_UNUSED;
}
- error = gfs2_meta_inode_buffer(ip, &dibh);
- if (!error) {
- ip->i_inode.i_ctime = current_time(&ip->i_inode);
- gfs2_trans_add_meta(ip->i_gl, dibh);
- gfs2_dinode_out(ip, dibh->b_data);
- brelse(dibh);
- }
+ ip->i_inode.i_ctime = current_time(&ip->i_inode);
+ __mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC);
gfs2_trans_end(GFS2_SB(&ip->i_inode));
--
2.13.6
next prev parent reply other threads:[~2017-11-13 14:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-13 14:35 [Cluster-devel] [PATCH 00/17] GFS2: Pre-pull patch posting (merge window) Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 01/17] gfs2: Clarify gfs2_block_map Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 02/17] gfs2: Update ctime in setflags ioctl Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 03/17] gfs2: Support negative atimes Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 04/17] gfs2: Always update inode ctime in set_acl Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 05/17] iomap: Switch from blkno to disk offset Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 06/17] iomap: Add IOMAP_F_DATA_INLINE flag Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 07/17] GFS2: Make height info part of metapath Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 08/17] GFS2: Implement iomap for block_map Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 09/17] GFS2: Switch fiemap implementation to use iomap Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 10/17] gfs2: Implement SEEK_HOLE / SEEK_DATA via iomap Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 11/17] GFS2: flush the log and all pages for jdata as we do for WB_SYNC_ALL Bob Peterson
2017-11-13 14:35 ` [Cluster-devel] [PATCH 12/17] GFS2: Take inode off order_write list when setting jdata flag Bob Peterson
2017-11-13 14:35 ` Bob Peterson [this message]
2017-11-13 14:35 ` [Cluster-devel] [PATCH 14/17] gfs2: Fix a harmless typo Bob Peterson
2017-11-13 14:36 ` [Cluster-devel] [PATCH 15/17] gfs2: Fix and clean up {GET, SET}FLAGS ioctl Bob Peterson
2017-11-13 14:36 ` [Cluster-devel] [PATCH 16/17] gfs2: Add support for statx inode flags Bob Peterson
2017-11-13 14:36 ` [Cluster-devel] [PATCH 17/17] gfs2: Allow gfs2_xattr_set to be called with the glock held Bob Peterson
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=20171113143602.1319-14-rpeterso@redhat.com \
--to=rpeterso@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).