* [PATCH 0/5] xfsprogs: 4.15 rollup pt. 2
@ 2018-01-03 18:39 Darrick J. Wong
2018-01-03 18:40 ` [PATCH 1/5] libhandle: zap fdhash in fshandle_destroy Darrick J. Wong
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Darrick J. Wong @ 2018-01-03 18:39 UTC (permalink / raw)
To: sandeen, darrick.wong; +Cc: linux-xfs
Hi all,
Here are some patches fixing up random odds and ends in 4.15. We fix some
CoW staging extent misreporting in xfs_db, an xfs_db crash when address
selectors have a trailing slash, libxfs api violations in xfs_repair, and
a grep pattern error in the libxfs api violation checking tool.
Eric: You might already have the first few of these; they haven't changed.
--D
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/5] libhandle: zap fdhash in fshandle_destroy
2018-01-03 18:39 [PATCH 0/5] xfsprogs: 4.15 rollup pt. 2 Darrick J. Wong
@ 2018-01-03 18:40 ` Darrick J. Wong
2018-01-03 18:40 ` [PATCH 2/5] xfs_db: check should deal with cow staging events correctly Darrick J. Wong
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Darrick J. Wong @ 2018-01-03 18:40 UTC (permalink / raw)
To: sandeen, darrick.wong; +Cc: linux-xfs
From: Darrick J. Wong <darrick.wong@oracle.com>
Set fdhash_head to zero once we've destroyed the handle list to avoid
dangling pointer problems.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
libhandle/handle.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libhandle/handle.c b/libhandle/handle.c
index e6971dd..878d14d 100644
--- a/libhandle/handle.c
+++ b/libhandle/handle.c
@@ -73,6 +73,7 @@ fshandle_destroy(void)
free(h);
h = nexth;
}
+ fdhash_head = NULL;
}
int
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/5] xfs_db: check should deal with cow staging events correctly
2018-01-03 18:39 [PATCH 0/5] xfsprogs: 4.15 rollup pt. 2 Darrick J. Wong
2018-01-03 18:40 ` [PATCH 1/5] libhandle: zap fdhash in fshandle_destroy Darrick J. Wong
@ 2018-01-03 18:40 ` Darrick J. Wong
2018-01-04 18:06 ` Darrick J. Wong
2018-01-04 18:12 ` Eric Sandeen
2018-01-03 18:40 ` [PATCH 3/5] xfs_db: fix crash when field list selector string has trailing slash Darrick J. Wong
` (2 subsequent siblings)
4 siblings, 2 replies; 10+ messages in thread
From: Darrick J. Wong @ 2018-01-03 18:40 UTC (permalink / raw)
To: sandeen, darrick.wong; +Cc: linux-xfs
From: Darrick J. Wong <darrick.wong@oracle.com>
Teach xfs_check to record cow staging events correctly. This means that
we strip off the high bit before using startblock.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
db/check.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/db/check.c b/db/check.c
index 3afde02..2f8dee5 100644
--- a/db/check.c
+++ b/db/check.c
@@ -4730,13 +4730,24 @@ scanfunc_refcnt(
lastblock = 0;
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
if (be32_to_cpu(rp[i].rc_refcount) == 1) {
- dbprintf(_(
- "leftover CoW extent (%u/%u) len %u\n"),
+ xfs_agblock_t agbno;
+ char *msg;
+
+ agbno = be32_to_cpu(rp[i].rc_startblock);
+ if (agbno >= XFS_REFC_COW_START) {
+ agbno -= XFS_REFC_COW_START;
+ msg = _(
+ "leftover CoW extent (%u/%u) len %u\n");
+ } else {
+ msg = _(
+ "leftover CoW extent at unexpected address (%u/%u) len %u\n");
+ }
+ dbprintf(msg,
seqno,
- be32_to_cpu(rp[i].rc_startblock),
+ agbno,
be32_to_cpu(rp[i].rc_blockcount));
set_dbmap(seqno,
- be32_to_cpu(rp[i].rc_startblock),
+ agbno,
be32_to_cpu(rp[i].rc_blockcount),
DBM_COWDATA, seqno, bno);
} else {
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/5] xfs_db: fix crash when field list selector string has trailing slash
2018-01-03 18:39 [PATCH 0/5] xfsprogs: 4.15 rollup pt. 2 Darrick J. Wong
2018-01-03 18:40 ` [PATCH 1/5] libhandle: zap fdhash in fshandle_destroy Darrick J. Wong
2018-01-03 18:40 ` [PATCH 2/5] xfs_db: check should deal with cow staging events correctly Darrick J. Wong
@ 2018-01-03 18:40 ` Darrick J. Wong
2018-01-03 18:40 ` [PATCH 4/5] xfs_repair: fix libxfs namespace problems Darrick J. Wong
2018-01-03 18:40 ` [PATCH 5/5] find-api-violations: fix a broken grep pattern Darrick J. Wong
4 siblings, 0 replies; 10+ messages in thread
From: Darrick J. Wong @ 2018-01-03 18:40 UTC (permalink / raw)
To: sandeen, darrick.wong; +Cc: linux-xfs
From: Darrick J. Wong <darrick.wong@oracle.com>
If I run the following command:
xfs_db /dev/sdf -x -c 'agf 0' -c 'addr refcntroot' -c 'addr ptrs[1]\'
then ftok_free crashes on an invalid free() because picking up the
previous token (the closing bracket) xrealloc'd the token array to be 5
elements long but never set the last element's tok pointer.
Consequently the ftok_free tries to free whatever garbage pointer is in
that last element and kaboom.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
db/flist.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/db/flist.c b/db/flist.c
index e11acbf..b207354 100644
--- a/db/flist.c
+++ b/db/flist.c
@@ -400,6 +400,7 @@ flist_split(
strncpy(a, s, l);
a[l] = '\0';
v = xrealloc(v, (nv + 2) * sizeof(*v));
+ v[nv + 1].tok = NULL;
v[nv].tok = a;
v[nv].tokty = t;
nv++;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/5] xfs_repair: fix libxfs namespace problems
2018-01-03 18:39 [PATCH 0/5] xfsprogs: 4.15 rollup pt. 2 Darrick J. Wong
` (2 preceding siblings ...)
2018-01-03 18:40 ` [PATCH 3/5] xfs_db: fix crash when field list selector string has trailing slash Darrick J. Wong
@ 2018-01-03 18:40 ` Darrick J. Wong
2018-01-04 18:29 ` Eric Sandeen
2018-01-03 18:40 ` [PATCH 5/5] find-api-violations: fix a broken grep pattern Darrick J. Wong
4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2018-01-03 18:40 UTC (permalink / raw)
To: sandeen, darrick.wong; +Cc: linux-xfs
From: Darrick J. Wong <darrick.wong@oracle.com>
Call libxfs_ functions, not xfs_ functions.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
libxfs/libxfs_api_defs.h | 2 +-
repair/dino_chunks.c | 2 +-
repair/phase6.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h
index 84a4fc2..0a5c84d 100644
--- a/libxfs/libxfs_api_defs.h
+++ b/libxfs/libxfs_api_defs.h
@@ -115,7 +115,7 @@
#define xfs_rmap_irec_offset_unpack libxfs_rmap_irec_offset_unpack
#define xfs_rmapbt_init_cursor libxfs_rmapbt_init_cursor
#define xfs_btree_del_cursor libxfs_btree_del_cursor
-
+#define xfs_mode_to_ftype libxfs_mode_to_ftype
#define xfs_log_sb libxfs_log_sb
#define xfs_sb_from_disk libxfs_sb_from_disk
diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c
index a3909ac..17de95f 100644
--- a/repair/dino_chunks.c
+++ b/repair/dino_chunks.c
@@ -845,7 +845,7 @@ process_inode_chunk(
* phase 6.
*/
set_inode_ftype(ino_rec, irec_offset,
- xfs_mode_to_ftype(be16_to_cpu(dino->di_mode)));
+ libxfs_mode_to_ftype(be16_to_cpu(dino->di_mode)));
/*
* store on-disk nlink count for comparing in phase 7
diff --git a/repair/phase6.c b/repair/phase6.c
index b326929..1a398aa 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -1081,7 +1081,7 @@ mv_orphanage(
if ((err = -libxfs_iget(mp, NULL, ino, 0, &ino_p)))
do_error(_("%d - couldn't iget disconnected inode\n"), err);
- xname.type = xfs_mode_to_ftype(VFS_I(ino_p)->i_mode);
+ xname.type = libxfs_mode_to_ftype(VFS_I(ino_p)->i_mode);
if (isa_dir) {
irec = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, orphanage_ino),
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/5] find-api-violations: fix a broken grep pattern
2018-01-03 18:39 [PATCH 0/5] xfsprogs: 4.15 rollup pt. 2 Darrick J. Wong
` (3 preceding siblings ...)
2018-01-03 18:40 ` [PATCH 4/5] xfs_repair: fix libxfs namespace problems Darrick J. Wong
@ 2018-01-03 18:40 ` Darrick J. Wong
2018-01-04 18:46 ` Eric Sandeen
4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2018-01-03 18:40 UTC (permalink / raw)
To: sandeen, darrick.wong; +Cc: linux-xfs
From: Darrick J. Wong <darrick.wong@oracle.com>
One of the grep patterns in find-api-violations is mistaken for a
(broken) range specifier when LC_ALL=C, so fix it to work properly.
This was found by wiring up the script to xfstests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tools/find-api-violations.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/find-api-violations.sh b/tools/find-api-violations.sh
index c2be4c5..3b976d3 100755
--- a/tools/find-api-violations.sh
+++ b/tools/find-api-violations.sh
@@ -10,7 +10,7 @@ tool_dirs="copy db estimate fsck fsr growfs io logprint mdrestore mkfs quota rep
# Calls to xfs_* functions in libxfs/*.c without the libxfs_ prefix
find_possible_api_calls() {
- grep -rn '[[:space:],-(]xfs_[a-z_]*(' $tool_dirs | sed -e 's/^.*\(xfs_[a-z_]*\)(.*$/\1/g' | sort | uniq
+ grep -rn '[-[:space:],(]xfs_[a-z_]*(' $tool_dirs | sed -e 's/^.*\(xfs_[a-z_]*\)(.*$/\1/g' | sort | uniq
}
check_if_api_calls() {
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/5] xfs_db: check should deal with cow staging events correctly
2018-01-03 18:40 ` [PATCH 2/5] xfs_db: check should deal with cow staging events correctly Darrick J. Wong
@ 2018-01-04 18:06 ` Darrick J. Wong
2018-01-04 18:12 ` Eric Sandeen
1 sibling, 0 replies; 10+ messages in thread
From: Darrick J. Wong @ 2018-01-04 18:06 UTC (permalink / raw)
To: sandeen; +Cc: linux-xfs
On Wed, Jan 03, 2018 at 10:40:19AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> Subject: [PATCH 2/5] xfs_db: check should deal with cow staging events correctly
s/events/extents/
> Teach xfs_check to record cow staging events correctly. This means that
s/events/extents/
> we strip off the high bit before using startblock.
high, indeed. :P
--D
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> db/check.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
>
> diff --git a/db/check.c b/db/check.c
> index 3afde02..2f8dee5 100644
> --- a/db/check.c
> +++ b/db/check.c
> @@ -4730,13 +4730,24 @@ scanfunc_refcnt(
> lastblock = 0;
> for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
> if (be32_to_cpu(rp[i].rc_refcount) == 1) {
> - dbprintf(_(
> - "leftover CoW extent (%u/%u) len %u\n"),
> + xfs_agblock_t agbno;
> + char *msg;
> +
> + agbno = be32_to_cpu(rp[i].rc_startblock);
> + if (agbno >= XFS_REFC_COW_START) {
> + agbno -= XFS_REFC_COW_START;
> + msg = _(
> + "leftover CoW extent (%u/%u) len %u\n");
> + } else {
> + msg = _(
> + "leftover CoW extent at unexpected address (%u/%u) len %u\n");
> + }
> + dbprintf(msg,
> seqno,
> - be32_to_cpu(rp[i].rc_startblock),
> + agbno,
> be32_to_cpu(rp[i].rc_blockcount));
> set_dbmap(seqno,
> - be32_to_cpu(rp[i].rc_startblock),
> + agbno,
> be32_to_cpu(rp[i].rc_blockcount),
> DBM_COWDATA, seqno, bno);
> } else {
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/5] xfs_db: check should deal with cow staging events correctly
2018-01-03 18:40 ` [PATCH 2/5] xfs_db: check should deal with cow staging events correctly Darrick J. Wong
2018-01-04 18:06 ` Darrick J. Wong
@ 2018-01-04 18:12 ` Eric Sandeen
1 sibling, 0 replies; 10+ messages in thread
From: Eric Sandeen @ 2018-01-04 18:12 UTC (permalink / raw)
To: Darrick J. Wong, sandeen; +Cc: linux-xfs
On 1/3/18 12:40 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Teach xfs_check to record cow staging events correctly. This means that
> we strip off the high bit before using startblock.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> db/check.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
>
> diff --git a/db/check.c b/db/check.c
> index 3afde02..2f8dee5 100644
> --- a/db/check.c
> +++ b/db/check.c
> @@ -4730,13 +4730,24 @@ scanfunc_refcnt(
> lastblock = 0;
> for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
> if (be32_to_cpu(rp[i].rc_refcount) == 1) {
> - dbprintf(_(
> - "leftover CoW extent (%u/%u) len %u\n"),
> + xfs_agblock_t agbno;
> + char *msg;
> +
> + agbno = be32_to_cpu(rp[i].rc_startblock);
> + if (agbno >= XFS_REFC_COW_START) {
> + agbno -= XFS_REFC_COW_START;
> + msg = _(
> + "leftover CoW extent (%u/%u) len %u\n");
> + } else {
> + msg = _(
> + "leftover CoW extent at unexpected address (%u/%u) len %u\n");
> + }
> + dbprintf(msg,
> seqno,
> - be32_to_cpu(rp[i].rc_startblock),
> + agbno,
> be32_to_cpu(rp[i].rc_blockcount));
> set_dbmap(seqno,
> - be32_to_cpu(rp[i].rc_startblock),
> + agbno,
> be32_to_cpu(rp[i].rc_blockcount),
> DBM_COWDATA, seqno, bno);
> } else {
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] xfs_repair: fix libxfs namespace problems
2018-01-03 18:40 ` [PATCH 4/5] xfs_repair: fix libxfs namespace problems Darrick J. Wong
@ 2018-01-04 18:29 ` Eric Sandeen
0 siblings, 0 replies; 10+ messages in thread
From: Eric Sandeen @ 2018-01-04 18:29 UTC (permalink / raw)
To: Darrick J. Wong, sandeen; +Cc: linux-xfs
On 1/3/18 12:40 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Call libxfs_ functions, not xfs_ functions.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Oops, thanks.
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 5/5] find-api-violations: fix a broken grep pattern
2018-01-03 18:40 ` [PATCH 5/5] find-api-violations: fix a broken grep pattern Darrick J. Wong
@ 2018-01-04 18:46 ` Eric Sandeen
0 siblings, 0 replies; 10+ messages in thread
From: Eric Sandeen @ 2018-01-04 18:46 UTC (permalink / raw)
To: Darrick J. Wong, sandeen; +Cc: linux-xfs
On 1/3/18 12:40 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> One of the grep patterns in find-api-violations is mistaken for a
> (broken) range specifier when LC_ALL=C, so fix it to work properly.
> This was found by wiring up the script to xfstests.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
I'm gonna have to take your word for it that your cat walked correctly
on the keyboard this time.
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> tools/find-api-violations.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
> diff --git a/tools/find-api-violations.sh b/tools/find-api-violations.sh
> index c2be4c5..3b976d3 100755
> --- a/tools/find-api-violations.sh
> +++ b/tools/find-api-violations.sh
> @@ -10,7 +10,7 @@ tool_dirs="copy db estimate fsck fsr growfs io logprint mdrestore mkfs quota rep
>
> # Calls to xfs_* functions in libxfs/*.c without the libxfs_ prefix
> find_possible_api_calls() {
> - grep -rn '[[:space:],-(]xfs_[a-z_]*(' $tool_dirs | sed -e 's/^.*\(xfs_[a-z_]*\)(.*$/\1/g' | sort | uniq
> + grep -rn '[-[:space:],(]xfs_[a-z_]*(' $tool_dirs | sed -e 's/^.*\(xfs_[a-z_]*\)(.*$/\1/g' | sort | uniq
> }
>
> check_if_api_calls() {
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-01-04 18:46 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-03 18:39 [PATCH 0/5] xfsprogs: 4.15 rollup pt. 2 Darrick J. Wong
2018-01-03 18:40 ` [PATCH 1/5] libhandle: zap fdhash in fshandle_destroy Darrick J. Wong
2018-01-03 18:40 ` [PATCH 2/5] xfs_db: check should deal with cow staging events correctly Darrick J. Wong
2018-01-04 18:06 ` Darrick J. Wong
2018-01-04 18:12 ` Eric Sandeen
2018-01-03 18:40 ` [PATCH 3/5] xfs_db: fix crash when field list selector string has trailing slash Darrick J. Wong
2018-01-03 18:40 ` [PATCH 4/5] xfs_repair: fix libxfs namespace problems Darrick J. Wong
2018-01-04 18:29 ` Eric Sandeen
2018-01-03 18:40 ` [PATCH 5/5] find-api-violations: fix a broken grep pattern Darrick J. Wong
2018-01-04 18:46 ` Eric Sandeen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.