Skip to contentSkip to conversation

xfs: compat_xfs_bstat does not have forkoff

PATCH In review Dave Chinner 2 participants 3 messages Sep 29, 2014 – Oct 1, 2014 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: compat_xfs_bstat does not have forkoff

From: Dave Chinner <[email protected]>

struct compat_xfs_bstat is missing the di_forkoff field and so does not fully translate the structure correctly. Fix it.

---
 fs/xfs/xfs_ioctl32.c | 2 ++
 fs/xfs/xfs_ioctl32.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_ioctl32.c +2 -0
index a554646..94ce027 100644
@@ -160,6 +160,7 @@ xfs_ioctl32_bstat_copyin(
 	    get_user(bstat->bs_gen,	&bstat32->bs_gen)	||
 	    get_user(bstat->bs_projid_lo, &bstat32->bs_projid_lo) ||
 	    get_user(bstat->bs_projid_hi, &bstat32->bs_projid_hi) ||
+	    get_user(bstat->bs_forkoff,	&bstat32->bs_forkoff)	||
 	    get_user(bstat->bs_dmevmask, &bstat32->bs_dmevmask)	||
 	    get_user(bstat->bs_dmstate,	&bstat32->bs_dmstate)	||
 	    get_user(bstat->bs_aextents, &bstat32->bs_aextents))
@@ -214,6 +215,7 @@ xfs_bulkstat_one_fmt_compat(
 	    put_user(buffer->bs_gen,	  &p32->bs_gen)		||
 	    put_user(buffer->bs_projid,	  &p32->bs_projid)	||
 	    put_user(buffer->bs_projid_hi,	&p32->bs_projid_hi)	||
+	    put_user(buffer->bs_forkoff,  &p32->bs_forkoff)	||
 	    put_user(buffer->bs_dmevmask, &p32->bs_dmevmask)	||
 	    put_user(buffer->bs_dmstate,  &p32->bs_dmstate)	||
 	    put_user(buffer->bs_aextents, &p32->bs_aextents))
fs/xfs/xfs_ioctl32.h +2 -1
index 80f4060..b1bb454 100644
@@ -67,8 +67,9 @@ typedef struct compat_xfs_bstat {
 	__u32		bs_gen;		/* generation count		*/
 	__u16		bs_projid_lo;	/* lower part of project id	*/
 #define	bs_projid	bs_projid_lo	/* (previously just bs_projid)	*/
+	__u16		bs_forkoff;	/* inode fork offset in bytes	*/
 	__u16		bs_projid_hi;	/* high part of project id	*/
-	unsigned char	bs_pad[12];	/* pad space, unused		*/
+	unsigned char	bs_pad[10];	/* pad space, unused		*/
 	__u32		bs_dmevmask;	/* DMIG event mask		*/
 	__u16		bs_dmstate;	/* DMIG state info		*/
 	__u16		bs_aextents;	/* attribute number of extents	*/
Signature · 6 lines
2.0.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Dave Chinner

From: Dave Chinner <[email protected]>

struct compat_xfs_bstat is missing the di_forkoff field and so does not fully translate the structure correctly. Fix it.

---
 fs/xfs/xfs_ioctl32.c | 2 ++
 fs/xfs/xfs_ioctl32.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

Looks good,

Any chance to get an xfstests test that verifies the forkoff value? Even if it would only reproduce this bug when running 32-bit userspace on a 64-bit kernel it would be useful I think.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Dave Chinner

From: Dave Chinner <[email protected]>

struct compat_xfs_bstat is missing the di_forkoff field and so does not fully translate the structure correctly. Fix it.

---
 fs/xfs/xfs_ioctl32.c | 2 ++
 fs/xfs/xfs_ioctl32.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
Quoted 7 lines

Looks good,

Any chance to get an xfstests test that verifies the forkoff value? Even if it would only reproduce this bug when running 32-bit userspace on a 64-bit kernel it would be useful I think.

There are already xfs_fsr tests that are dependent on forkoff being set to correctly defrag a file successfully. The fact that nobody has noticed that these fail tends to imply nobody runs xfstests with a 32 bit userspace on 64 bit kernels....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs