From owner-svn-src-projects@freebsd.org Tue Apr 24 20:22:00 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CEE6FB2287 for ; Tue, 24 Apr 2018 20:22:00 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AF466957A; Tue, 24 Apr 2018 20:22:00 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0E4817F6B; Tue, 24 Apr 2018 20:21:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3OKLxCS028973; Tue, 24 Apr 2018 20:21:59 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3OKLxtw028972; Tue, 24 Apr 2018 20:21:59 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201804242021.w3OKLxtw028972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 24 Apr 2018 20:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r332969 - projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Commit-Revision: 332969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2018 20:22:00 -0000 Author: rmacklem Date: Tue Apr 24 20:21:59 2018 New Revision: 332969 URL: https://svnweb.freebsd.org/changeset/base/332969 Log: Add a sysctl called vfs.nfsd.flexlinuxhack which can be set non-zero to work around a Linux Flexible File Layout driver bug that causes it to use the synthetic user/group for "tightly coupled" servers like this one. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Tue Apr 24 20:05:45 2018 (r332968) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Tue Apr 24 20:21:59 2018 (r332969) @@ -105,6 +105,11 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, pnfsstrictatime, CTLFL &nfsrv_pnfsatime, 0, "For pNFS service, do Getattr ops to keep atime up-to-date"); +int nfsrv_flexlinuxhack = 0; +SYSCTL_INT(_vfs_nfsd, OID_AUTO, flexlinuxhack, CTLFLAG_RW, + &nfsrv_flexlinuxhack, 0, + "For Linux clients, hack around Flex File Layout bug"); + /* * Hash lists for nfs V4. */ @@ -6432,13 +6437,15 @@ nfsrv_filelayout(struct nfsrv_descript *nd, int iomode } #define FLEX_OWNERID "999" +#define FLEX_UID0 "0" /* * Generate a Flex File Layout. * The FLEX_OWNERID can be any string of 3 decimal digits. Although this * string goes on the wire, it isn't supposed to be used by the client, * since this server uses tight coupling. - * The Linux Flexible File Layout client driver doesn't like a Null string - * for these. + * Although not recommended by the spec., if vfs.nfsd.flexlinuxhack=1 use + * a string of "0". This works around the Linux Flex File Layout driver bug + * which uses the synthetic uid/gid strings for the "tightly coupled" case. */ static struct nfslayout * nfsrv_flexlayout(struct nfsrv_descript *nd, int iomode, int mirrorcnt, @@ -6480,10 +6487,19 @@ nfsrv_flexlayout(struct nfsrv_descript *nd, int iomode NFSBCOPY(dsfhp, tl, sizeof(*dsfhp)); tl += (NFSM_RNDUP(NFSX_V4PNFSFH) / NFSX_UNSIGNED); dsfhp++; - *tl++ = txdr_unsigned(strlen(FLEX_OWNERID)); /* Any uid. */ - NFSBCOPY(FLEX_OWNERID, tl++, NFSX_UNSIGNED); - *tl++ = txdr_unsigned(strlen(FLEX_OWNERID)); /* Any gid. */ - NFSBCOPY(FLEX_OWNERID, tl++, NFSX_UNSIGNED); + if (nfsrv_flexlinuxhack != 0) { + *tl++ = txdr_unsigned(strlen(FLEX_UID0)); + *tl = 0; /* 0 pad string. */ + NFSBCOPY(FLEX_UID0, tl++, strlen(FLEX_UID0)); + *tl++ = txdr_unsigned(strlen(FLEX_UID0)); + *tl = 0; /* 0 pad string. */ + NFSBCOPY(FLEX_UID0, tl++, strlen(FLEX_UID0)); + } else { + *tl++ = txdr_unsigned(strlen(FLEX_OWNERID)); + NFSBCOPY(FLEX_OWNERID, tl++, NFSX_UNSIGNED); + *tl++ = txdr_unsigned(strlen(FLEX_OWNERID)); + NFSBCOPY(FLEX_OWNERID, tl++, NFSX_UNSIGNED); + } } *tl++ = txdr_unsigned(0); /* ff_flags. */ *tl = txdr_unsigned(60); /* Status interval hint. */