Message ID | 160503140288.1201232.14448155271122385848.stgit@magnolia (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | xfsprogs: fixes for 5.10 | expand |
On Tue, Nov 10, 2020 at 10:03:22AM -0800, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@oracle.com> > > If the caller passes in an extent size hint of zero, clear the inherit > flags because a hint value of zero is treated as not a hint. > > Otherwise, you get stupid stuff like: > $ mkfs.xfs -d cowextsize=0 /tmp/a.img -f > illegal CoW extent size hint 0, must be less than 9600. Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 908d520df909..9989cf57c295 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1438,11 +1438,17 @@ data_opts_parser( break; case D_EXTSZINHERIT: cli->fsx.fsx_extsize = getnum(value, opts, subopt); - cli->fsx.fsx_xflags |= FS_XFLAG_EXTSZINHERIT; + if (cli->fsx.fsx_extsize) + cli->fsx.fsx_xflags |= FS_XFLAG_EXTSZINHERIT; + else + cli->fsx.fsx_xflags &= ~FS_XFLAG_EXTSZINHERIT; break; case D_COWEXTSIZE: cli->fsx.fsx_cowextsize = getnum(value, opts, subopt); - cli->fsx.fsx_xflags |= FS_XFLAG_COWEXTSIZE; + if (cli->fsx.fsx_cowextsize) + cli->fsx.fsx_xflags |= FS_XFLAG_COWEXTSIZE; + else + cli->fsx.fsx_xflags &= ~FS_XFLAG_COWEXTSIZE; break; case D_DAXINHERIT: if (getnum(value, opts, subopt))