Date: Thu, 15 Jun 2017 00:32:01 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r319961 - projects/pnfs-planb-server/sys/fs/nfsserver Message-ID: <201706150032.v5F0W1tn067841@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <filename>" 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706150032.v5F0W1tn067841>