mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 11:13:58 +08:00
gfs2: Fix xattr fsync
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>
This commit is contained in:
parent
cc555b09d8
commit
6862c44ec5
@ -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_sbd *sdp = GFS2_SB(&ip->i_inode);
|
||||||
struct gfs2_rgrpd *rgd;
|
struct gfs2_rgrpd *rgd;
|
||||||
struct gfs2_holder rg_gh;
|
struct gfs2_holder rg_gh;
|
||||||
struct buffer_head *dibh;
|
|
||||||
__be64 *dataptrs;
|
__be64 *dataptrs;
|
||||||
u64 bn = 0;
|
u64 bn = 0;
|
||||||
u64 bstart = 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;
|
ea->ea_num_ptrs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = gfs2_meta_inode_buffer(ip, &dibh);
|
ip->i_inode.i_ctime = current_time(&ip->i_inode);
|
||||||
if (!error) {
|
__mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
gfs2_trans_end(sdp);
|
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)
|
ea_skeleton_call_t skeleton_call, void *private)
|
||||||
{
|
{
|
||||||
struct gfs2_alloc_parms ap = { .target = blks };
|
struct gfs2_alloc_parms ap = { .target = blks };
|
||||||
struct buffer_head *dibh;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = gfs2_rindex_update(GFS2_SB(&ip->i_inode));
|
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)
|
if (error)
|
||||||
goto out_end_trans;
|
goto out_end_trans;
|
||||||
|
|
||||||
error = gfs2_meta_inode_buffer(ip, &dibh);
|
ip->i_inode.i_ctime = current_time(&ip->i_inode);
|
||||||
if (!error) {
|
__mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC);
|
||||||
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_end_trans:
|
out_end_trans:
|
||||||
gfs2_trans_end(GFS2_SB(&ip->i_inode));
|
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_header *ea, struct ea_set *es)
|
||||||
{
|
{
|
||||||
struct gfs2_ea_request *er = es->es_er;
|
struct gfs2_ea_request *er = es->es_er;
|
||||||
struct buffer_head *dibh;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + 2 * RES_EATTR, 0);
|
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)
|
if (es->es_el)
|
||||||
ea_set_remove_stuffed(ip, 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);
|
ip->i_inode.i_ctime = current_time(&ip->i_inode);
|
||||||
gfs2_trans_add_meta(ip->i_gl, dibh);
|
__mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC);
|
||||||
gfs2_dinode_out(ip, dibh->b_data);
|
|
||||||
brelse(dibh);
|
|
||||||
out:
|
|
||||||
gfs2_trans_end(GFS2_SB(&ip->i_inode));
|
gfs2_trans_end(GFS2_SB(&ip->i_inode));
|
||||||
return error;
|
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 *ea = el->el_ea;
|
||||||
struct gfs2_ea_header *prev = el->el_prev;
|
struct gfs2_ea_header *prev = el->el_prev;
|
||||||
struct buffer_head *dibh;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0);
|
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;
|
ea->ea_type = GFS2_EATYPE_UNUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = gfs2_meta_inode_buffer(ip, &dibh);
|
ip->i_inode.i_ctime = current_time(&ip->i_inode);
|
||||||
if (!error) {
|
__mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
gfs2_trans_end(GFS2_SB(&ip->i_inode));
|
gfs2_trans_end(GFS2_SB(&ip->i_inode));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user