From patchwork Tue Aug 2 06:49:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 9255221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C34E6048B for ; Tue, 2 Aug 2016 06:49:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C1E028502 for ; Tue, 2 Aug 2016 06:49:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4066A28506; Tue, 2 Aug 2016 06:49:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A7C6528502 for ; Tue, 2 Aug 2016 06:49:14 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 4619D7D3C; Tue, 2 Aug 2016 01:49:12 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay1.corp.sgi.com [137.38.102.111]) by oss.sgi.com (Postfix) with ESMTP id 9944C7D3B for ; Tue, 2 Aug 2016 01:49:09 -0500 (CDT) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay1.corp.sgi.com (Postfix) with ESMTP id 6AFA18F8033 for ; Mon, 1 Aug 2016 23:49:06 -0700 (PDT) X-ASG-Debug-ID: 1470120544-0bf57c13682d55d0001-NocioJ Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id xogMWTE9VHPtEBWB (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 01 Aug 2016 23:49:05 -0700 (PDT) X-Barracuda-Envelope-From: zlang@redhat.com X-Barracuda-Effective-Source-IP: mx1.redhat.com[209.132.183.28] X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-ASG-Whitelist: Client Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B6CC834 for ; Tue, 2 Aug 2016 06:49:04 +0000 (UTC) Received: from localhost (dhcp-12-154.nay.redhat.com [10.66.12.154]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u726n3aN022099; Tue, 2 Aug 2016 02:49:04 -0400 From: Zorro Lang To: xfs@oss.sgi.com Subject: [PATCH] xfs_quota: fall back silently if XFS_GETNEXTQUOTA fails Date: Tue, 2 Aug 2016 14:49:00 +0800 X-ASG-Orig-Subj: [PATCH] xfs_quota: fall back silently if XFS_GETNEXTQUOTA fails Message-Id: <1470120540-15135-1-git-send-email-zlang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 02 Aug 2016 06:49:04 +0000 (UTC) X-Barracuda-Connect: mx1.redhat.com[209.132.183.28] X-Barracuda-Start-Time: 1470120545 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.176.15:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 2247 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 Cc: sandeen@redhat.com, Zorro Lang X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Zorro Lang --- Hi, Both dump_file and report_mount have this problem, so I fix them together. xfstests xfs/299 can reproduce this bug in report_mount, the newest xfs/106 can reproduce both(dump and report, hope I didn't miss others:). This patch checks "if cmd == XFS_GETQUOTA", but I'm thinking about if we should check "if !(cmd == XFS_GETNEXTQUOTA && errno == EINVAL)"? The first one don't print all errors from XFS_GETNEXTQUOTA, but the second one only for EINVAL error. So the question become should we: 1) fall back silently if XFS_GETNEXTQUOTA fails? 2) Or fall back silently if kernel has no XFS_GETNEXTQUOTA feature? I think both of them make sense. What do you think? Thanks, Zorro quota/report.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/quota/report.c b/quota/report.c index 59290e1..70220b4 100644 --- a/quota/report.c +++ b/quota/report.c @@ -90,8 +90,10 @@ dump_file( else cmd = XFS_GETQUOTA; + /* Fall back silently if XFS_GETNEXTQUOTA fails, warn on XFS_GETQUOTA */ if (xfsquotactl(cmd, dev, type, id, (void *)&d) < 0) { - if (errno != ENOENT && errno != ENOSYS && errno != ESRCH) + if (errno != ENOENT && errno != ENOSYS && errno != ESRCH && + cmd == XFS_GETQUOTA) perror("XFS_GETQUOTA"); return 0; } @@ -347,8 +349,10 @@ report_mount( else cmd = XFS_GETQUOTA; + /* Fall back silently if XFS_GETNEXTQUOTA fails, warn on XFS_GETQUOTA*/ if (xfsquotactl(cmd, dev, type, id, (void *)&d) < 0) { - if (errno != ENOENT && errno != ENOSYS && errno != ESRCH) + if (errno != ENOENT && errno != ENOSYS && errno != ESRCH && + cmd == XFS_GETQUOTA) perror("XFS_GETQUOTA"); return 0; }