Skip to contentSkip to conversation

GFS2: dirty inode correctly in gfs2_write_end for jdata

PATCH Superseded Bob Peterson 2 participants 2 messages Jun 18, 2018 – Jul 3, 2018 1 message not in the archive GFS2 file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 GFS2: dirty inode correctly in gfs2_write_end for jdata

In reply to a message not in the archive

Hi,

I'm going over some old upstream patches I have squirreled away. Here's one:
---
In patch 0c9018097f, function gfs2_write_end was changed so that it marked inodes dirty if they had new buffers queued to the current transaction. Unfortunately, it was only done for ordered data files. The check was never done for jdata files, so the inode was never properly marked dirty. This patch adds the additional check so that jdata files are also marked dirty.

---
 fs/gfs2/aops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/aops.c +1 -1
index 35f5ee23566d..9e24494fc5be 100644
@@ -900,7 +900,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
 
 	ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
 	page = NULL;
-	if (tr->tr_num_buf_new)
+	if (tr->tr_num_buf_new || tr->tr_num_databuf_new)
 		__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
 	else
 		gfs2_trans_add_meta(ip->i_gl, dibh);
#2 lore raw

PATCH 1/1 GFS2: dirty inode correctly in gfs2_write_end for jdata

Quoted 11 lines · Bob Peterson

Hi,

I'm going over some old upstream patches I have squirreled away. Here's one:
---
In patch 0c9018097f, function gfs2_write_end was changed so that it marked inodes dirty if they had new buffers queued to the current transaction. Unfortunately, it was only done for ordered data files. The check was never done for jdata files, so the inode was never properly marked dirty. This patch adds the additional check so that jdata files are also marked dirty.

I'd be much happier if this came with a test case.

Quoted 11 lines
---
 fs/gfs2/aops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/aops.c +0 -0
index 35f5ee23566d..9e24494fc5be 100644

fs/gfs2/aops.c static int gfs2_write_end(struct file *file, struct address_space *mapping, · line 906

Quoted 8 lines
fs/gfs2/aops.c +1 -1
@@ -900,7 +900,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
 
        ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
        page = NULL;
-       if (tr->tr_num_buf_new)
+       if (tr->tr_num_buf_new || tr->tr_num_databuf_new)
                __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
        else
                gfs2_trans_add_meta(ip->i_gl, dibh);

Thanks,
Andreas