Skip to contentSkip to conversation

GFS2: O_TRUNC not working on stuffed files across cluster

PATCH New Bob Peterson 2 participants 2 messages Jun 24, 2010 – Jun 25, 2010 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: O_TRUNC not working on stuffed files across cluster

Hi,

This patch replaces a statement that got dropped out by accident. Without the patch, truncates on stuffed (very small) files cause those files to have an unpredictable size.

Regards,

Bob Peterson
Red Hat File Systems

--

 fs/gfs2/bmap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/gfs2/bmap.c +1 -0
index 0db0cd9..a7b1c7c 100644
@@ -1042,6 +1042,7 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
 
 	if (gfs2_is_stuffed(ip)) {
 		u64 dsize = size + sizeof(struct gfs2_inode);
+		ip->i_disksize = size;
 		ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
 		gfs2_trans_add_bh(ip->i_gl, dibh, 1);
 		gfs2_dinode_out(ip, dibh->b_data);
#1 lore raw

PATCH 1/1 GFS2: O_TRUNC not working on stuffed files across cluster

Hi,

Now in the -nmw tree. Thanks,

Steve.

Quoted 29 lines · Bob Peterson

Hi,

This patch replaces a statement that got dropped out by accident. Without the patch, truncates on stuffed (very small) files cause those files to have an unpredictable size.

Regards,

Bob Peterson
Red Hat File Systems

--

 fs/gfs2/bmap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/gfs2/bmap.c +1 -0
index 0db0cd9..a7b1c7c 100644
@@ -1042,6 +1042,7 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
 
 	if (gfs2_is_stuffed(ip)) {
 		u64 dsize = size + sizeof(struct gfs2_inode);
+		ip->i_disksize = size;
 		ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
 		gfs2_trans_add_bh(ip->i_gl, dibh, 1);
 		gfs2_dinode_out(ip, dibh->b_data);