RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1444166 - mkfs.xfs ignores sunit=0, swidth=0 settings when creating new XFS filesystem.
Summary: mkfs.xfs ignores sunit=0, swidth=0 settings when creating new XFS filesystem.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: xfsprogs
Version: 7.3
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 7.3
Assignee: Eric Sandeen
QA Contact: Zorro Lang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-20 18:41 UTC by Scott Greenberg
Modified: 2020-06-11 13:39 UTC (History)
3 users (show)

Fixed In Version: xfsprogs-4.5.0-13.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 15:08:20 UTC
Target Upstream Version:
Embargoed:
sgreenbe: needinfo-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0847 0 None None None 2018-04-10 15:08:50 UTC

Description Scott Greenberg 2017-04-20 18:41:14 UTC
Description of problem:

When trying to create a new xfs filesystem on a RHEL 7.3 machine with the sunit and swidth values manually set to 0, filesystem is made with those values set to sunit=16,swidth=10752.  This only happens on a particular Hitachi Lun directly attached via SAN.

# mkfs.xfs -d sunit=0,swidth=0 /dev/`uname -n`vg/lv

Version-Release number of selected component (if applicable):
xfsprogs-3.2.2-2.el7.x86_64

kernel-version:
kernel-3.10.0-514.6.1.el7.x86_64                            Thu Mar  2 11:01:29 2017


How reproducible:
Customer can reproduce every time they make a new xfs filesystem on a Hitachi Lun directly attached via SAN.

Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: HITACHI  Model: OPEN-V           Rev: 8001
  Type:   Direct-Access                    ANSI  SCSI revision: 05


Steps to Reproduce:
1. Create new lv on existing vg with lvcreate
2. mkfs.xfs -d sunit=0,swidth=0 <lv>

See xfs_example.png attached to bug for a screenshot of this process.

Customer can repeat the above steps on their Hitachi Lun and mkfs.xfs seems to ignore or auto-calculate the sunit and swidth values based upon that underlying hardware rather than the options passed into mkfs.xfs.

Customer has attempted this process in a VM and is unable to replicate in that environment. 

Actual results:

# lvcreate -L 32m -n  wra1 `uname -n`vg00
  Logical volume "wra1" created.
root@s51r010:/root
# mkfs.xfs -d sunit=0,swidth=0 /dev/`uname -n`vg00/wra1
meta-data=/dev/s51r010vg00/wra1  isize=256    agcount=2, agsize=4096 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=8192, imaxpct=25
         =                       sunit=16     swidth=10752 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=768, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Expected results:

# mkfs.xfs -d sunit=0,swidth=0 /dev/`uname -n`vg00/wra1
meta-data=/dev/s51r010vg00/wra1  isize=256    agcount=2, agsize=4096 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=8192, imaxpct=25
         =                       sunit=0     swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=768, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Additional info:

Comment 2 Eric Sandeen 2017-04-20 18:53:12 UTC
Please try:

mkfs.xfs -d noalign ....

From the manpage:

noalign
  This option disables automatic geometry detection and creates the
  filesystem  without  stripe  geometry  alignment even if the
  underlying storage device provides this information.

It would be nice if specifying 0 had this same effect, but in the short term I believe that the "noalign" option will do what the customer wants.  Can you confirm?

Thanks,
-Eric

Comment 3 Zorro Lang 2017-04-23 07:50:42 UTC
We met this problem before when we ran xfstests striped storage device, and I use "-d sunit=0,swidth=0,noalign" to keep away that problem. It works, but we don't suggest to do that except you know what you want.

Thanks,
Zorro

Comment 4 Eric Sandeen 2017-04-24 14:05:48 UTC
Yes, I also wonder why there is a need to override the storage-specified geometry.  Still, if it is what is needed, it should be possible.


Anyway, Scott, can you confirm that the workaround will resolve the issue in the short term?

Thanks,
-Eric

Comment 5 Eric Sandeen 2017-06-16 16:50:24 UTC
The reason the code is behaving this way, btw, is that the sunit & swidth variables are set to 0 in the code to mean "not specified."

So, specifying them as zero on the commandline currently looks exactly the same as if it were not specified at all, and automatic detection still happens.

Scott, where do you want to go with this bug & the associated case.  Is the customer happy with the noalign option?

Comment 6 Eric Sandeen 2017-07-14 21:58:43 UTC
I sent a patch upstream for this,
[PATCH] mkfs.xfs: allow specification of 0 data stripe width & unit

... but I've not merged it upstream yet.  Still, a patch is available.

Comment 8 Dave Wysochanski 2017-07-25 14:38:35 UTC
Looks like a straightforward patch to me.

Comment 10 Eric Sandeen 2017-10-05 19:10:45 UTC
commit 746d40a73162f942f63f6a2f612f491d107b9824
Author: Eric Sandeen <sandeen>
Date:   Thu Jul 20 10:51:34 2017 -0500

    mkfs.xfs: allow specification of 0 data stripe width & unit
    
    The "noalign" option works for this too, but it seems reasonable
    to allow explicit specification of stripe unit and stripe width
    to 0; today, doing so today makes the code think it's unspecified,
    and so it goes ahead and detects stripe geometry and sets it in the
    superblock.  That's unexpected and surprising.
    
    Create a new flag that tracks whtether a geometry option has been
    specified, and if it's set along with 0 values, treat it the
    same as if "noalign" had been specified.
    
    Signed-off-by: Eric Sandeen <sandeen>
    Reviewed-by: Christoph Hellwig <hch>
    Signed-off-by: Eric Sandeen <sandeen>

Comment 16 errata-xmlrpc 2018-04-10 15:08:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0847


Note You need to log in before you can comment on or make changes to this bug.