From patchwork Mon May 13 09:14:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingbo Xu X-Patchwork-Id: 10940581 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A016B6C5 for ; Mon, 13 May 2019 09:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9190F2012F for ; Mon, 13 May 2019 09:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 844E4237A5; Mon, 13 May 2019 09:15:01 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70E4F2012F for ; Mon, 13 May 2019 09:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728833AbfEMJOw (ORCPT ); Mon, 13 May 2019 05:14:52 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:40072 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728328AbfEMJOw (ORCPT ); Mon, 13 May 2019 05:14:52 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R371e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07486;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0TRai557_1557738882; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0TRai557_1557738882) by smtp.aliyun-inc.com(127.0.0.1); Mon, 13 May 2019 17:14:49 +0800 From: Jeffle Xu To: fstests@vger.kernel.org Cc: caspar@linux.alibaba.com, amir73il@gmail.com, Jeffle Xu Subject: [PATCH v2] common/rc: improve _fstyp_has_non_default_seek_data_hole() Date: Mon, 13 May 2019 17:14:41 +0800 Message-Id: <1557738881-3750-1-git-send-email-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP commit 34081087 adds more sanity to seek_sanity_test() to prevent a lseek() implementation regression from being ignored, and a hardcoded whitelist is maintained to distinguish whether a filesystem type only supports non-default behavior of SEEK_HOLE or not. In commit 34081087, NFS is listed in this whitelist, that is, NFS is thought supporting non-default behavior only. However as far as I know, nfsv2 and nfsv3 only support default behavior of SEEK_HOLE (that is, always returning EOF) in linux. On the other hand, xfstests uses "mount -t nfs ..." to mount a NFS mount point. Normally the mount point is mounted as nfsv4, but it can be mounted mandatorily as nfsv3 if we specify "Nfsvers=3" in /etc/nfsmount.conf. In this case, a series of tests fail (including generic/285, generic/448, generic/490, etc.) with error message "Default behavior is not allowed. Aborting." So I just make some special handling for NFS in _fstyp_has_non_default_seek_data_hole(), that is, default behavior of SEEK_HOLE is acceptable for nfsv2 and nfsv3. Thanks. Signed-off-by: Jeffle Xu Reviewed-by: Amir Goldstein --- common/rc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index cbd3c59..27c8bb7 100644 --- a/common/rc +++ b/common/rc @@ -2315,9 +2315,16 @@ _fstyp_has_non_default_seek_data_hole() fi case "$fstyp" in - btrfs|ext4|xfs|ceph|cifs|f2fs|gfs2|nfs*|ocfs2|tmpfs) + btrfs|ext4|xfs|ceph|cifs|f2fs|gfs2|ocfs2|tmpfs) return 0 ;; + nfs*) + # NFSv2 and NFSv3 only support default behavior of SEEK_HOLE, + # while NFSv4 supports non-default behavior + local nfsvers=`_df_device $TEST_DEV | $AWK_PROG '{ print $2 }'` + [ "$nfsvers" = "nfs4" ] + return $? + ;; overlay) if [ ! -z $OVL_BASE_FSTYP -a $OVL_BASE_FSTYP != "overlay" ]; then _fstyp_has_non_default_seek_data_hole $OVL_BASE_FSTYP