* [PATCH] erofs-utils: lib: fix packed pos in erofs_xattr_flush_name_prefixes()
@ 2026-11-03 12:54 Gao Xiang
0 siblings, 0 replies; only message in thread
From: Gao Xiang @ 2026-11-03 12:54 UTC (permalink / raw)
To: linux-erofs; +Cc: Gao Xiang, Yifan Zhao
erofs_os_lseek() usage is no longer valid.
Fixes: bfc94a2580c0 ("erofs-utils: lib: track packed inode position explicitly")
Fixes: e2d8dde04abf ("erofs-utils: add native Windows support")
Reported-by: Yifan Zhao <stopire@gmail.com>
Closes: https://lore.kernel.org/r/6f29b317-9df0-4e96-94c0-e3c3858f41e5@gmail.com
Signed-off-by: Gao Xiang <xiang@kernel.org>
---
lib/fragments.c | 4 +++-
lib/liberofs_fragments.h | 2 +-
lib/xattr.c | 11 +++++------
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/lib/fragments.c b/lib/fragments.c
index 61577d2..d4e79b2 100644
--- a/lib/fragments.c
+++ b/lib/fragments.c
@@ -403,8 +403,10 @@ int erofs_flush_packed_inode(struct erofs_importer *im)
return 0;
}
-int erofs_packedfile(struct erofs_sb_info *sbi)
+int erofs_packedfile(struct erofs_sb_info *sbi, erofs_off_t **ppos)
{
+ if (ppos)
+ *ppos = &sbi->packedinode->pos;
return sbi->packedinode->fd;
}
diff --git a/lib/liberofs_fragments.h b/lib/liberofs_fragments.h
index cf54936..57fe952 100644
--- a/lib/liberofs_fragments.h
+++ b/lib/liberofs_fragments.h
@@ -20,6 +20,6 @@ int erofs_fragment_pack(struct erofs_inode *inode, void *data,
erofs_off_t pos, erofs_off_t len, u32 tofh, bool tail);
int erofs_fragment_commit(struct erofs_inode *inode, u32 tofh);
int erofs_flush_packed_inode(struct erofs_importer *im);
-int erofs_packedfile(struct erofs_sb_info *sbi);
+int erofs_packedfile(struct erofs_sb_info *sbi, erofs_off_t **ppos);
#endif
diff --git a/lib/xattr.c b/lib/xattr.c
index 93cfead..c670b12 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -885,6 +885,7 @@ int erofs_xattr_flush_name_prefixes(struct erofs_importer *im, bool plain)
struct erofs_buffer_head *bh = NULL;
struct erofs_vfile _vf;
struct ea_type_node *tnode;
+ erofs_off_t *ppos = NULL;
s64 start, offset = 0;
int err;
@@ -897,11 +898,9 @@ int erofs_xattr_flush_name_prefixes(struct erofs_importer *im, bool plain)
vf = bmgr->vf;
} else if (may_fragments) {
erofs_sb_set_fragments(sbi);
- _vf = (struct erofs_vfile){ .fd = erofs_packedfile(sbi) };
+ _vf = (struct erofs_vfile){ .fd = erofs_packedfile(sbi, &ppos) };
vf = &_vf;
- offset = erofs_os_lseek(vf->fd, 0, SEEK_CUR);
- if (offset < 0)
- return -errno;
+ offset = *ppos;
bmgr = NULL;
} else {
plain = true;
@@ -960,8 +959,8 @@ int erofs_xattr_flush_name_prefixes(struct erofs_importer *im, bool plain)
erofs_bdrop(bh, false);
} else {
DBG_BUGON(bmgr);
- if (erofs_os_lseek(vf->fd, offset, SEEK_SET) < 0)
- return -errno;
+ if (ppos)
+ *ppos = offset;
}
erofs_sb_set_xattr_prefixes(sbi);
return 0;
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-03 12:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 12:54 [PATCH] erofs-utils: lib: fix packed pos in erofs_xattr_flush_name_prefixes() Gao Xiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox