Skip to contentSkip to conversation

GFS2: dirty inode correctly in gfs2_iomap_end for jdata

PATCH New Bob Peterson 2 participants 2 messages Jul 3, 2018 1 message not in the archive GFS2 file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/1 GFS2: dirty inode correctly in gfs2_iomap_end for jdata

Hi,

I posted an equivalent patch on 18 June which was largely ignored. This is revised for the recent iomap changes.
---
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. The affected code has since been moved to function gfs2_iomap_end. This patch adds the additional check so that jdata files are also marked dirty.

---
 fs/gfs2/bmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/bmap.c +1 -1
index 49a6ab919bd7..afbee7e4ae5b 100644
@@ -1116,7 +1116,7 @@ static int gfs2_iomap_end(struct inode *inode, loff_t pos, loff_t length,
 	if (iomap->type != IOMAP_INLINE) {
 		gfs2_ordered_add_inode(ip);
 
-		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 v2 1/1 GFS2: dirty inode correctly in gfs2_iomap_end for jdata

Quoted 12 lines · Bob Peterson

Hi,

I posted an equivalent patch on 18 June which was largely ignored. This is revised for the recent iomap changes.
---
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. The affected code has since been moved to function gfs2_iomap_end. This patch adds the additional check so that jdata files are also marked dirty.

Like I just said in the previous posting of this fix, I'd be much happier to have a test case.

Quoted 11 lines
---
 fs/gfs2/bmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/bmap.c +0 -0
index 49a6ab919bd7..afbee7e4ae5b 100644

fs/gfs2/bmap.c static int gfs2_iomap_end(struct inode *inode, loff_t pos, loff_t length, · line 1122

Quoted 8 lines
fs/gfs2/bmap.c +1 -1
@@ -1116,7 +1116,7 @@ static int gfs2_iomap_end(struct inode *inode, loff_t pos, loff_t length,
        if (iomap->type != IOMAP_INLINE) {
                gfs2_ordered_add_inode(ip);
 
-               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