* [PATCHSET] xfsprogs: random bug fixes
@ 2025-02-03 22:40 Darrick J. Wong
2025-02-03 22:40 ` [PATCH 1/3] mkfs: fix file size setting when interpreting a protofile Darrick J. Wong
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Darrick J. Wong @ 2025-02-03 22:40 UTC (permalink / raw)
To: djwong, aalbersh; +Cc: hch, linux-xfs
Hi all,
Apologies for the late pile of assorted bug fixes. I discovered a few
bugs relating to protofiles because I failed to notice that my
functional test for xfs_protofile didn't quite cover enough cases and
didn't get back to this for a month while fstests was in disarray.
I'm hoping that as the commits being fixed were merged for 6.13, could we
please review and merge them before tagging xfsprogs 6.13? Pretty please? :)
If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.
With a bit of luck, this should all go splendidly.
Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=random-fixes
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=random-fixes
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=random-fixes
---
Commits in this patchset:
* libxfs-apply: allow stgit users to force-apply a patch
* fs: turn on more warnings for the filesystem code we modify most
* mkfs: fix file size setting when interpreting a protofile
* xfs_protofile: fix mode formatting error
* xfs_protofile: fix device number encoding
---
mkfs/proto.c | 5 +----
mkfs/xfs_protofile.in | 4 ++--
2 files changed, 3 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] mkfs: fix file size setting when interpreting a protofile
2025-02-03 22:40 [PATCHSET] xfsprogs: random bug fixes Darrick J. Wong
@ 2025-02-03 22:40 ` Darrick J. Wong
2025-02-04 4:53 ` Christoph Hellwig
2025-02-03 22:40 ` [PATCH 2/3] xfs_protofile: fix mode formatting error Darrick J. Wong
2025-02-03 22:40 ` [PATCH 3/3] xfs_protofile: fix device number encoding Darrick J. Wong
2 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2025-02-03 22:40 UTC (permalink / raw)
To: djwong, aalbersh; +Cc: hch, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
When we're copying a regular file into the filesystem, we should set the
size of the new file to the size indicated by the stat data, not the
highest offset written, because we now use SEEK_DATA/HOLE to ignore
sparse regions.
Fixes: 73fb78e5ee8940 ("mkfs: support copying in large or sparse files")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
mkfs/proto.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/mkfs/proto.c b/mkfs/proto.c
index 4e9e28d4eea1ca..6dd3a2005b15b3 100644
--- a/mkfs/proto.c
+++ b/mkfs/proto.c
@@ -313,7 +313,6 @@ writefile(
struct xfs_mount *mp = ip->i_mount;
struct stat statbuf;
off_t data_pos;
- off_t eof = 0;
int error;
/* do not try to read from non-regular files */
@@ -340,8 +339,6 @@ writefile(
}
writefile_range(ip, fname, fd, data_pos, hole_pos - data_pos);
- eof = hole_pos;
-
data_pos = lseek(fd, hole_pos, SEEK_DATA);
}
if (data_pos < 0 && errno != ENXIO)
@@ -354,7 +351,7 @@ writefile(
fail(_("error creating isize transaction"), error);
libxfs_trans_ijoin(tp, ip, 0);
- ip->i_disk_size = eof;
+ ip->i_disk_size = statbuf.st_size;
libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
error = -libxfs_trans_commit(tp);
if (error)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] xfs_protofile: fix mode formatting error
2025-02-03 22:40 [PATCHSET] xfsprogs: random bug fixes Darrick J. Wong
2025-02-03 22:40 ` [PATCH 1/3] mkfs: fix file size setting when interpreting a protofile Darrick J. Wong
@ 2025-02-03 22:40 ` Darrick J. Wong
2025-02-04 4:53 ` Christoph Hellwig
2025-02-03 22:40 ` [PATCH 3/3] xfs_protofile: fix device number encoding Darrick J. Wong
2 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2025-02-03 22:40 UTC (permalink / raw)
To: djwong, aalbersh; +Cc: hch, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
The protofile parser expects the mode to be specified with three octal
digits. Unfortunately, the generator doesn't get that right if the mode
doesn't have any of bits 8-11 (aka no owner access privileges) set.
Fixes: 6aace700b7b82d ("mkfs: add a utility to generate protofiles")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
mkfs/xfs_protofile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkfs/xfs_protofile.in b/mkfs/xfs_protofile.in
index 9aee4336888523..356d3d80b32521 100644
--- a/mkfs/xfs_protofile.in
+++ b/mkfs/xfs_protofile.in
@@ -45,7 +45,7 @@ def stat_to_str(statbuf):
perms = stat.S_IMODE(statbuf.st_mode)
- return '%s%s%s%o %d %d' % (type, suid, sgid, perms, statbuf.st_uid, \
+ return '%s%s%s%03o %d %d' % (type, suid, sgid, perms, statbuf.st_uid, \
statbuf.st_gid)
def stat_to_extra(statbuf, fullpath):
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] xfs_protofile: fix device number encoding
2025-02-03 22:40 [PATCHSET] xfsprogs: random bug fixes Darrick J. Wong
2025-02-03 22:40 ` [PATCH 1/3] mkfs: fix file size setting when interpreting a protofile Darrick J. Wong
2025-02-03 22:40 ` [PATCH 2/3] xfs_protofile: fix mode formatting error Darrick J. Wong
@ 2025-02-03 22:40 ` Darrick J. Wong
2025-02-04 4:56 ` Christoph Hellwig
2 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2025-02-03 22:40 UTC (permalink / raw)
To: djwong, aalbersh; +Cc: hch, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Actually crack major/minor device numbers from the stat results that we
get when we encounter a character/block device file.
Fixes: 6aace700b7b82d ("mkfs: add a utility to generate protofiles")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
mkfs/xfs_protofile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkfs/xfs_protofile.in b/mkfs/xfs_protofile.in
index 356d3d80b32521..e83c39f5325846 100644
--- a/mkfs/xfs_protofile.in
+++ b/mkfs/xfs_protofile.in
@@ -54,7 +54,7 @@ def stat_to_extra(statbuf, fullpath):
if stat.S_ISREG(statbuf.st_mode):
return ' %s' % fullpath
elif stat.S_ISCHR(statbuf.st_mode) or stat.S_ISBLK(statbuf.st_mode):
- return ' %d %d' % (statbuf.st_rdev, statbuf.st_rdev)
+ return ' %d %d' % (os.major(statbuf.st_rdev), os.minor(statbuf.st_rdev))
elif stat.S_ISLNK(statbuf.st_mode):
return ' %s' % os.readlink(fullpath)
return ''
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] mkfs: fix file size setting when interpreting a protofile
2025-02-03 22:40 ` [PATCH 1/3] mkfs: fix file size setting when interpreting a protofile Darrick J. Wong
@ 2025-02-04 4:53 ` Christoph Hellwig
0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2025-02-04 4:53 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: aalbersh, hch, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] xfs_protofile: fix mode formatting error
2025-02-03 22:40 ` [PATCH 2/3] xfs_protofile: fix mode formatting error Darrick J. Wong
@ 2025-02-04 4:53 ` Christoph Hellwig
0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2025-02-04 4:53 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: aalbersh, hch, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] xfs_protofile: fix device number encoding
2025-02-03 22:40 ` [PATCH 3/3] xfs_protofile: fix device number encoding Darrick J. Wong
@ 2025-02-04 4:56 ` Christoph Hellwig
0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2025-02-04 4:56 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: aalbersh, hch, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-02-04 4:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 22:40 [PATCHSET] xfsprogs: random bug fixes Darrick J. Wong
2025-02-03 22:40 ` [PATCH 1/3] mkfs: fix file size setting when interpreting a protofile Darrick J. Wong
2025-02-04 4:53 ` Christoph Hellwig
2025-02-03 22:40 ` [PATCH 2/3] xfs_protofile: fix mode formatting error Darrick J. Wong
2025-02-04 4:53 ` Christoph Hellwig
2025-02-03 22:40 ` [PATCH 3/3] xfs_protofile: fix device number encoding Darrick J. Wong
2025-02-04 4:56 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox