From owner-svn-src-projects@freebsd.org Thu Jun 15 00:32:02 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62440BF7419 for ; Thu, 15 Jun 2017 00:32:02 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2D5BE7E7C1; Thu, 15 Jun 2017 00:32:02 +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 v5F0W1o5067842; Thu, 15 Jun 2017 00:32:01 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5F0W1tn067841; Thu, 15 Jun 2017 00:32:01 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201706150032.v5F0W1tn067841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 15 Jun 2017 00:32:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r319961 - projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Group: projects 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.23 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: Thu, 15 Jun 2017 00:32:02 -0000 Author: rmacklem Date: Thu Jun 15 00:32:01 2017 New Revision: 319961 URL: https://svnweb.freebsd.org/changeset/base/319961 Log: Modify the handling of getattr for the DS attributes so that instead of failing for the case where the pnfsd.dsattr extended attribute does not exist, a Getattr RPC against the DS is attempted to (re)create this extended attribute. This allows a sysadmin to "rmextattr system pnfsd.dsattr " on the MDS exported file system file, if these attributes somehow get messed up. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Thu Jun 15 00:26:27 2017 (r319960) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Thu Jun 15 00:32:01 2017 (r319961) @@ -3909,19 +3909,28 @@ nfsrv_proxyds(struct nfsrv_descript *nd, struct vnode nap->na_size = dsattr.dsa_size; nap->na_atime = dsattr.dsa_atime; nap->na_mtime = dsattr.dsa_mtime; + + /* + * If nfsrv_pnfsgetdsattr is 0 or nfsrv_checkdsattr() + * returns 0, just return now. nfsrv_checkdsattr() + * returns 0 if there is no Read/Write layout + * plus either an Open/Write_access or Write + * delegation issued to a client for the file. + */ + if (nfsrv_pnfsgetdsattr == 0 || + nfsrv_checkdsattr(nd, vp, p) == 0) { + free(buf, M_TEMP); + return (error); + } } /* - * If nfsrv_pnfsgetdsattr is 0 or nfsrv_checkdsattr() returns - * 0, just return now. nfsrv_checkdsattr() returns 0 if there - * is no Read/Write layout + either an Open/Write_access or - * Write delegation issued to a client for the file. + * Clear ENOATTR so the code below will attempt to do a + * nfsrv_getattrdsrpc() to get the attributes and (re)create + * the extended attribute. */ - if (nfsrv_pnfsgetdsattr == 0 || nfsrv_checkdsattr(nd, vp, p) == - 0) { - free(buf, M_TEMP); - return (error); - } + if (error == ENOATTR) + error = 0; } if (error == 0) { @@ -4439,7 +4448,6 @@ nfsrv_getattrdsrpc(fhandle_t *fhp, struct ucred *cred, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL); if (error == 0) { - /* Do this as root so that it won't EACCES fail. */ error = nfsrv_setextattr(vp, nap, p); NFSD_DEBUG(4, "nfsrv_getattrdsrpc: aft setextat=%d\n", error);