On 8/2/16 7:27 AM, Christoph Hellwig wrote: > On Tue, Aug 02, 2016 at 02:49:00PM +0800, Zorro Lang wrote: >> After XFS_GETNEXTQUOTA feature has been merged into linux kernel and >> xfsprogs, xfs_quota use Q_XGETNEXTQUOTA for report and dump, and >> fall back to old XFS_GETQUOTA ioctl if XFS_GETNEXTQUOTA fails. >> >> But when XFS_GETNEXTQUOTA fails, xfs_quota print a warning as >> "XFS_GETQUOTA: Invalid argument". That's due to kernel can't >> recognize XFS_GETNEXTQUOTA ioctl and return EINVAL. At this time, >> the warning is helpless, xfs_quota just need to fall back. > > We'd still want to report other errors, right? I advised Zorro to do it this way, because -EINVAL can have a few meanings, and we don't know for sure why we got it. Could be a bad cmd, or a bad type, or ... If it fails, we're going to fall back anyway, so for any other error we'd print it twice; on the fallback, we'd print the real unexpected error anyway, so I think the user will get the relevant information in this case. But I guess we could do: + /* EINVAL is expected for XFS_GETNEXTQUOTA on older kernels */ if (xfsquotactl(cmd, dev, type, id, (void *)&d) < 0) { + if (errno != ENOENT && errno != ENOSYS && errno != ESRCH && + (cmd == XFS_GETNEXTQUOTA && errno != EINVAL) and then change what we print (not perror("XFS_GETQUOTA") in all cases)? But if we got i.e. EPERM, we'd print the EPERM error twice; once for the first call, and once for the fallback. I suppose that'd be ok, but not sure it's helpful. -Eric _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs