Bug 1018751 - xfs_io: XFS_IOC_FSGEOMETRY: Inappropriate ioctl for device when pwrite to devnull resides on xfs
Summary: xfs_io: XFS_IOC_FSGEOMETRY: Inappropriate ioctl for device when pwrite to dev...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: xfsprogs
Version: 6.5
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: Eryu Guan
URL:
Whiteboard:
Depends On:
Blocks: 1020057
TreeView+ depends on / blocked
 
Reported: 2013-10-14 11:25 UTC by Eryu Guan
Modified: 2014-10-14 07:49 UTC (History)
1 user (show)

Fixed In Version: xfsprogs-3.1.1-15.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1020057 (view as bug list)
Environment:
Last Closed: 2014-10-14 07:49:48 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1564 0 normal SHIPPED_LIVE xfsprogs bug update 2014-10-14 01:27:44 UTC

Description Eryu Guan 2013-10-14 11:25:33 UTC
Description of problem:

Found this by xfstests generic/306.

mknod /mnt/xfs/devnull c 1 3
xfs_io -c "pwrite 0 512" /mnt/xfs/devnull
XFS_IOC_FSGEOMETRY: Inappropriate ioctl for device

If I add -F option to xfs_io then pwrite succeeds.

xfs_io -F -c "pwrite 0 512" /mnt/xfs/devnull
wrote 512/512 bytes at offset 0
512.000000 bytes, 1 ops; 0.0000 sec (162.760 MiB/sec and 333333.3333 ops/sec)

Not sure if it's really a problem, it seems to me that it's writing to an xfs partition, -F option should not make any difference.

Version-Release number of selected component (if applicable):
xfsprogs-3.1.1-14.el6

How reproducible:
always

Steps to Reproduce:
1. see description
2.
3.

Actual results:


Expected results:


Additional info:
generic/306 output

[root@hp-dl388g8-03 xfstests]# diff -u /var/lib/xfstests/tests/generic/306.out /var/lib/xfstests/results/generic/306.out.bad
--- /var/lib/xfstests/tests/generic/306.out     2013-10-03 19:09:05.000000000 +0800
+++ /var/lib/xfstests/results/generic/306.out.bad       2013-10-14 19:24:18.104405221 +0800
@@ -2,11 +2,9 @@
 == try to create new file
 touch: cannot touch `SCRATCH_MNT/this_should_fail': Read-only file system
 == pwrite to null device
-wrote 512/512 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+XFS_IOC_FSGEOMETRY: Inappropriate ioctl for device
 == pread from zero device
-read 512/512 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+XFS_IOC_FSGEOMETRY: Inappropriate ioctl for device
 == truncating write to null device
 == appending write to null device
 == writing to symlink from ro fs to rw fs

Comment 1 Eric Sandeen 2013-10-14 16:36:33 UTC
Thanks Eryu; I had found this too.

Sent a patch upstream, 

[PATCH] xfsprogs: restrict platform_test_xfs_fd to regular files

-Eric

Comment 2 Eric Sandeen 2013-10-14 22:29:31 UTC
Fixed in xfsprogs-3.2.0-0.1.alpha1.el7

Comment 5 Eric Sandeen 2013-10-16 18:45:20 UTC
Sorry, getting my releases mixed up.  Fixed this one in RHEL7, not RHEL6 yet.

(it is very low priority, TBH, so I won't try to lobby for blocker or anything).

Comment 6 Eric Sandeen 2014-05-05 17:18:27 UTC
commit fcd6fa7f6a29188a756ff8b071a152bc9d62baf4
Author: Eric Sandeen <sandeen@redhat.com>
Date:   Tue Oct 8 15:17:50 2013 +0000

    xfsprogs: restrict platform_test_xfs_fd to regular files
    
    If a special file (block, char, pipe etc) resides on an
    xfs filesystem, platform_test_xfs_[fd|path] will return
    true, but a subsequent xfsctl will fail, because the file
    operations to support the xfs ioctls are not set up on such
    files (see i_fop assignments in xfs_setup_inode()).
    
    From the xfsctl manpage it's pretty clear that these functions
    are supposed to return true if a subsequent xfsctl can be
    handled, so it makes sense to exclude special files.
    
    This was showing up in xfstest generic/306, which creates
    the dev/null block device on an xfstest an tries to pwrite
    to it with xfs_io - which emitted a warning when the xfsctl
    trying to get geometry failed.
    
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Rich Johnston <rjohnston@sgi.com>

Comment 8 Eryu Guan 2014-06-29 15:39:46 UTC
xfs_io now reports "is not on an XFS filesystem"

[root@hp-dl388g8-03 xfstests]# grep testarea /proc/mounts 
/dev/mapper/vg_hpdl388g803-testlv2 /mnt/testarea/scratch xfs rw,seclabel,relatime,attr2,delaylog,logbsize=256k,sunit=512,swidth=6144,noquota 0 0
[root@hp-dl388g8-03 xfstests]# ll /mnt/testarea/scratch/
total 0
-rw-r--r--. 1 root root    0 Jun 29 11:32 bindfile
crw-r--r--. 1 root root 1, 3 Jun 29 11:32 devnull
crw-r--r--. 1 root root 1, 5 Jun 29 11:32 devzero
lrwxrwxrwx. 1 root root   25 Jun 29 11:32 symlink -> /mnt/testarea/test/target

[root@hp-dl388g8-03 xfstests]# xfs_io -c "pwrite 0 512" /mnt/testarea/scratch/devnull
xfs_io: specified file ["/mnt/testarea/scratch/devnull"] is not on an XFS filesystem

# but -F works fine
[root@hp-dl388g8-03 xfstests]# xfs_io -F -c "pwrite 0 512" /mnt/testarea/scratch/devnull
wrote 512/512 bytes at offset 0
512.000000 bytes, 1 ops; 0.0000 sec (81.380 MiB/sec and 166666.6667 ops/sec)

Seems not fully fixed?

Comment 9 Eric Sandeen 2014-06-30 15:39:55 UTC
Hm, shoot.  Upstream, -F is deprecated so I didn't notice:

d1b8818 xfs_io: deprecate the "-F" foreign flag

Argh, so we've traded an invalid ioctl message for a not-xfs message, I'm sorry.  :(

Does this cause problems with xfstests?

Using xfs_io to write to /dev/null probably doesn't matter to a customer, it's more of an internal testing usecase.

I think that what would really need to be merged to fix this properly is the -F deprecation patch.

How important is this for RHEL6.6?

Comment 10 Eryu Guan 2014-07-01 04:04:32 UTC
(In reply to Eric Sandeen from comment #9)
> Hm, shoot.  Upstream, -F is deprecated so I didn't notice:
> 
> d1b8818 xfs_io: deprecate the "-F" foreign flag
> 
> Argh, so we've traded an invalid ioctl message for a not-xfs message, I'm
> sorry.  :(
> 
> Does this cause problems with xfstests?

Yes, generic/306 is failing with different diffs now

[root@hp-dl388g8-03 xfstests]# diff -u tests/generic/306.out /var/lib/xfstests/results//generic/306.out.bad
--- tests/generic/306.out       2014-06-29 11:12:55.000000000 -0400
+++ /var/lib/xfstests/results//generic/306.out.bad      2014-06-30 23:59:39.206793425 -0400
@@ -2,11 +2,9 @@
 == try to create new file
 touch: cannot touch 'SCRATCH_MNT/this_should_fail': Read-only file system
 == pwrite to null device
-wrote 512/512 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+xfs_io: specified file ["/mnt/testarea/scratch/devnull"] is not on an XFS filesystem
 == pread from zero device
-read 512/512 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+xfs_io: specified file ["/mnt/testarea/scratch/devzero"] is not on an XFS filesystem
 == truncating write to null device
 == appending write to null device
 == writing to symlink from ro fs to rw fs
> 
> Using xfs_io to write to /dev/null probably doesn't matter to a customer,
> it's more of an internal testing usecase.
> 
> I think that what would really need to be merged to fix this properly is the
> -F deprecation patch.
> 
> How important is this for RHEL6.6?

I'd say it's low priority, it only fails generic/306 case. Maybe we can mark this bug as VERIFIED and file a new bug and decide whether we fix the -F deprecation issue there?

Comment 13 errata-xmlrpc 2014-10-14 07:49:48 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.

http://rhn.redhat.com/errata/RHBA-2014-1564.html


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