Re: mkfs error: "existing superblock read failed: Inappropriate ioctl for device"

Brian Foster
2015-03-26T15:25:27Z

On Thu, Mar 26, 2015 at 04:27:50PM +0300, Alexander Tsvetkov wrote:
> Hello,
>
> I have the following error message: "existing superblock read failed:
> Inappropriate ioctl for device"
> after attempt to make xfs image with "mkfs.xfs -f -m crc=1 -d
> file=1,name=xfs.fs,size=32m":
>
> "meta-data=xfs.fs 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=853, version=2
> = sectsz=512 sunit=0 blks, lazy-count=1
> realtime =none extsz=4096 blocks=0, rtextents=0
> existing superblock read failed: Inappropriate ioctl for device"
>
> Filesystem is created and mounted as usually, xfs_repair passes, no messages
> in the system log.
> Configuration: Fedora 20 x86_64 on vbox, kernel 4.0.0-rc5, xfsprogs version
> 3.2.2.
>

This appears to come from zero_old_xfs_structures() where we try and
zero out any old data structures on the target device. pread() of the
superblock returns 0, because we open the target with O_CREAT|O_TRUNC if
it is a file (e.g., the file size is 0 so any reads will return 0). It's
not an error, so I suspect the error string there is stale from a
previous operation. Indeed, from strace:

...
ioctl(3, BLKDISCARD, {0, 7ffc2904a180}) = -1 ENOTTY (Inappropriate ioctl for device)
...
write(2, "existing superblock read failed:"..., 64existing superblock read failed: Inappropriate ioctl for device
) = 64
...

I'll send a patch in a bit, but the short of it is that this is
harmless. The side effect is we skip out of the function that zeroes old
metadata, but the file has already been truncated and thus effectively
zeroed out.

Brian

> Thanks,
> Alexander Tsvetkov
>
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com