* [PATCH] xfs_db: make write/fuzz -c and -d work on non-crc filesystems
@ 2017-08-17 16:53 Darrick J. Wong
2017-08-17 21:31 ` Eric Sandeen
2017-08-18 8:59 ` Carlos Maiolino
0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2017-08-17 16:53 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs, eguan
For a non-crc filesystem, make write/fuzz -c and -d work properly
instead of bailing out. Since there's no checksum to update, both
cases collapse to setting the field value without calling the write
verifier.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
db/fuzz.c | 8 ++++++--
db/write.c | 7 +++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/db/fuzz.c b/db/fuzz.c
index 76dbf94..53cedbc 100644
--- a/db/fuzz.c
+++ b/db/fuzz.c
@@ -125,7 +125,9 @@ fuzz_f(
return 0;
}
- if (invalid_data && iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF) {
+ if (invalid_data &&
+ iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF &&
+ xfs_sb_version_hascrc(&mp->m_sb)) {
dbprintf(_("Cannot recalculate CRCs on this type of object\n"));
return 0;
}
@@ -149,7 +151,9 @@ fuzz_f(
local_ops.verify_read = stashed_ops->verify_read;
iocur_top->bp->b_ops = &local_ops;
- if (corrupt) {
+ if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+ local_ops.verify_write = xfs_dummy_verify;
+ } else if (corrupt) {
local_ops.verify_write = xfs_dummy_verify;
dbprintf(_("Allowing fuzz of corrupted data and bad CRC\n"));
} else if (iocur_top->typ->crc_off == TYP_F_CRC_FUNC) {
diff --git a/db/write.c b/db/write.c
index 9fc6d8e..5ef76bc 100644
--- a/db/write.c
+++ b/db/write.c
@@ -138,7 +138,8 @@ write_f(
}
if (invalid_data &&
- iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF) {
+ iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF &&
+ xfs_sb_version_hascrc(&mp->m_sb)) {
dbprintf(_("Cannot recalculate CRCs on this type of object\n"));
return 0;
}
@@ -162,7 +163,9 @@ write_f(
local_ops.verify_read = stashed_ops->verify_read;
iocur_top->bp->b_ops = &local_ops;
- if (corrupt) {
+ if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+ local_ops.verify_write = xfs_dummy_verify;
+ } else if (corrupt) {
local_ops.verify_write = xfs_dummy_verify;
dbprintf(_("Allowing write of corrupted data and bad CRC\n"));
} else if (iocur_top->typ->crc_off == TYP_F_CRC_FUNC) {
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] xfs_db: make write/fuzz -c and -d work on non-crc filesystems
2017-08-17 16:53 [PATCH] xfs_db: make write/fuzz -c and -d work on non-crc filesystems Darrick J. Wong
@ 2017-08-17 21:31 ` Eric Sandeen
2017-08-18 8:59 ` Carlos Maiolino
1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2017-08-17 21:31 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs, eguan
On 8/17/17 11:53 AM, Darrick J. Wong wrote:
> For a non-crc filesystem, make write/fuzz -c and -d work properly
> instead of bailing out. Since there's no checksum to update, both
> cases collapse to setting the field value without calling the write
> verifier.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> db/fuzz.c | 8 ++++++--
> db/write.c | 7 +++++--
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/db/fuzz.c b/db/fuzz.c
> index 76dbf94..53cedbc 100644
> --- a/db/fuzz.c
> +++ b/db/fuzz.c
> @@ -125,7 +125,9 @@ fuzz_f(
> return 0;
> }
>
> - if (invalid_data && iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF) {
> + if (invalid_data &&
> + iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF &&
> + xfs_sb_version_hascrc(&mp->m_sb)) {
> dbprintf(_("Cannot recalculate CRCs on this type of object\n"));
> return 0;
> }
> @@ -149,7 +151,9 @@ fuzz_f(
> local_ops.verify_read = stashed_ops->verify_read;
> iocur_top->bp->b_ops = &local_ops;
>
> - if (corrupt) {
> + if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> + local_ops.verify_write = xfs_dummy_verify;
> + } else if (corrupt) {
> local_ops.verify_write = xfs_dummy_verify;
> dbprintf(_("Allowing fuzz of corrupted data and bad CRC\n"));
> } else if (iocur_top->typ->crc_off == TYP_F_CRC_FUNC) {
> diff --git a/db/write.c b/db/write.c
> index 9fc6d8e..5ef76bc 100644
> --- a/db/write.c
> +++ b/db/write.c
> @@ -138,7 +138,8 @@ write_f(
> }
>
> if (invalid_data &&
> - iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF) {
> + iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF &&
> + xfs_sb_version_hascrc(&mp->m_sb)) {
> dbprintf(_("Cannot recalculate CRCs on this type of object\n"));
> return 0;
> }
> @@ -162,7 +163,9 @@ write_f(
> local_ops.verify_read = stashed_ops->verify_read;
> iocur_top->bp->b_ops = &local_ops;
>
> - if (corrupt) {
> + if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> + local_ops.verify_write = xfs_dummy_verify;
> + } else if (corrupt) {
> local_ops.verify_write = xfs_dummy_verify;
> dbprintf(_("Allowing write of corrupted data and bad CRC\n"));
> } else if (iocur_top->typ->crc_off == TYP_F_CRC_FUNC) {
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] xfs_db: make write/fuzz -c and -d work on non-crc filesystems
2017-08-17 16:53 [PATCH] xfs_db: make write/fuzz -c and -d work on non-crc filesystems Darrick J. Wong
2017-08-17 21:31 ` Eric Sandeen
@ 2017-08-18 8:59 ` Carlos Maiolino
1 sibling, 0 replies; 3+ messages in thread
From: Carlos Maiolino @ 2017-08-18 8:59 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Eric Sandeen, xfs, eguan
On Thu, Aug 17, 2017 at 09:53:31AM -0700, Darrick J. Wong wrote:
> For a non-crc filesystem, make write/fuzz -c and -d work properly
> instead of bailing out. Since there's no checksum to update, both
> cases collapse to setting the field value without calling the write
> verifier.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
> db/fuzz.c | 8 ++++++--
> db/write.c | 7 +++++--
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/db/fuzz.c b/db/fuzz.c
> index 76dbf94..53cedbc 100644
> --- a/db/fuzz.c
> +++ b/db/fuzz.c
> @@ -125,7 +125,9 @@ fuzz_f(
> return 0;
> }
>
> - if (invalid_data && iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF) {
> + if (invalid_data &&
> + iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF &&
> + xfs_sb_version_hascrc(&mp->m_sb)) {
> dbprintf(_("Cannot recalculate CRCs on this type of object\n"));
> return 0;
> }
> @@ -149,7 +151,9 @@ fuzz_f(
> local_ops.verify_read = stashed_ops->verify_read;
> iocur_top->bp->b_ops = &local_ops;
>
> - if (corrupt) {
> + if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> + local_ops.verify_write = xfs_dummy_verify;
> + } else if (corrupt) {
> local_ops.verify_write = xfs_dummy_verify;
> dbprintf(_("Allowing fuzz of corrupted data and bad CRC\n"));
> } else if (iocur_top->typ->crc_off == TYP_F_CRC_FUNC) {
> diff --git a/db/write.c b/db/write.c
> index 9fc6d8e..5ef76bc 100644
> --- a/db/write.c
> +++ b/db/write.c
> @@ -138,7 +138,8 @@ write_f(
> }
>
> if (invalid_data &&
> - iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF) {
> + iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF &&
> + xfs_sb_version_hascrc(&mp->m_sb)) {
> dbprintf(_("Cannot recalculate CRCs on this type of object\n"));
> return 0;
> }
> @@ -162,7 +163,9 @@ write_f(
> local_ops.verify_read = stashed_ops->verify_read;
> iocur_top->bp->b_ops = &local_ops;
>
> - if (corrupt) {
> + if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> + local_ops.verify_write = xfs_dummy_verify;
> + } else if (corrupt) {
> local_ops.verify_write = xfs_dummy_verify;
> dbprintf(_("Allowing write of corrupted data and bad CRC\n"));
> } else if (iocur_top->typ->crc_off == TYP_F_CRC_FUNC) {
> --
> 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
--
Carlos
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-18 8:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-17 16:53 [PATCH] xfs_db: make write/fuzz -c and -d work on non-crc filesystems Darrick J. Wong
2017-08-17 21:31 ` Eric Sandeen
2017-08-18 8:59 ` Carlos Maiolino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox