From patchwork Sat Dec 31 13:05:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 9492725 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 07FB462ABB for ; Sat, 31 Dec 2016 13:05:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4892203C0 for ; Sat, 31 Dec 2016 13:05:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D57E424B44; Sat, 31 Dec 2016 13:05:23 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 C02EE203C0 for ; Sat, 31 Dec 2016 13:05:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753736AbcLaNFV (ORCPT ); Sat, 31 Dec 2016 08:05:21 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35138 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753239AbcLaNFU (ORCPT ); Sat, 31 Dec 2016 08:05:20 -0500 Received: by mail-pg0-f67.google.com with SMTP id i5so25069444pgh.2 for ; Sat, 31 Dec 2016 05:05:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=Zk6ZmZltr48lK5N4Xw6nUTzE0rbBgadivMvLWP42LkI=; b=hcxGbAowOenCOI0egECXlqL+tiKAuRbcwbIJ5NwfI4cdgEoh2CrMG5V+VeTLn+TAVa TtBbujyuhnwrXTvbxEN/JGQkwRa6Q5jsOyWSLJzxdpbXiG5V2N99SlsPA9Kdt7n8oPk6 42GA917EGKfLIOjUg518m6L6IQ6drW1YeAisGizw+Yq8y0AIAqf1E0m8kEjLAJiQMacd DoHnaqNF1PQKKDyN+4kbwf+G0e0Ek6KUoWgmAeYKQkK4EN38oTDpB07hRQCLpGqamfEb tOIobWgz0SAkxXL3kC7iaamnOOSRiUz89f1wf2GmU2O/ok/pC2jmt2LyW88mmc7th6jZ R45A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=Zk6ZmZltr48lK5N4Xw6nUTzE0rbBgadivMvLWP42LkI=; b=KMxntzL6BkCJcJwZkweXwWejmbXNovay5r4eakFNHSR0jf44Y5rqu3VVRHlkvKHGoH z8Ac5BDEKdB51xb/EgnHrY3wFxqImM9D0uTgsbKZ9VxLKWjPYBn5LGsztwAwQlzAQKPt Mux2FpJ/6KxxcrNNSV7txAwd0EqxFkXA3oPc5V2JE32U1VfqVb9CI5ip534mvaFcPdIu GJpWgp/sKe1W1ZU3jOUE/9Cm8xi5SRzl/qJ8TKpAnGqYrCOsRFs5Km/VB9aBmJgl+2AQ nJtPovfzOlo5blnJS0OYbDijEnKIKhhfMojFVe4e+oAydr3Rwg2FmBtRIy4UK1Te7ye1 VtQg== X-Gm-Message-State: AIkVDXJP97nUHORGRr20EMp+C32moB24joXSXoJtslK1wmblJeyV8TTbb6as5UiRpHxN0g== X-Received: by 10.84.224.206 with SMTP id k14mr33496451pln.26.1483189519895; Sat, 31 Dec 2016 05:05:19 -0800 (PST) Received: from [192.168.0.104] ([183.228.30.39]) by smtp.googlemail.com with ESMTPSA id s65sm120794969pgb.25.2016.12.31.05.05.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Dec 2016 05:05:19 -0800 (PST) To: Steve Dickson , linux-nfs@vger.kernel.org Cc: kinglongmee@gmail.com, Christoph Hellwig From: Kinglong Mee Subject: [PATCH] exportfs: Make sure pass all valid export flags to nfsd Message-ID: Date: Sat, 31 Dec 2016 21:05:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP test_export pass a export flags only marks NFSEXP_FSID, nfsd may want other flags for export checking. This patch make sure exportfs pass all other flags to nfsd. Signed-off-by: Kinglong Mee --- utils/exportfs/exportfs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index 15a1583..bacf106 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -473,8 +473,10 @@ static int can_test(void) return 1; } -static int test_export(char *path, int with_fsid) +static int test_export(nfs_export *exp, int with_fsid) { + char *path = exp->m_export.e_path; + int flags = exp->m_export.e_flags | (with_fsid ? NFSEXP_FSID : 0); /* beside max path, buf size should take protocol str into account */ char buf[NFS_MAXPATHLEN+1+64] = { 0 }; char *bp = buf; @@ -487,7 +489,7 @@ static int test_export(char *path, int with_fsid) qword_add(&bp, &len, path); if (len < 1) return 0; - snprintf(bp, len, " 3 %d 65534 65534 0\n", with_fsid ? NFSEXP_FSID : 0); + snprintf(bp, len, " 3 %d 65534 65534 0\n", flags); fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY); if (fd < 0) return 0; @@ -529,12 +531,12 @@ validate_export(nfs_export *exp) if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid || fs_has_fsid) { - if ( !test_export(path, 1)) { + if ( !test_export(exp, 1)) { xlog(L_ERROR, "%s does not support NFS export", path); return; } - } else if ( ! test_export(path, 0)) { - if (test_export(path, 1)) + } else if ( !test_export(exp, 0)) { + if (test_export(exp, 1)) xlog(L_ERROR, "%s requires fsid= for NFS export", path); else xlog(L_ERROR, "%s does not support NFS export", path);