NFSv4.1: Use layout credentials for get_deviceinfo calls
This is not strictly needed, since get_deviceinfo is not allowed to return NFS4ERR_ACCESS or NFS4ERR_WRONG_CRED, but lets do it anyway for consistency with other pNFS operations. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
ab7cb0dfab
commit
cd5875fefe
7 changed files with 22 additions and 10 deletions
|
@ -1091,7 +1091,7 @@ nfs4_blk_get_deviceinfo(struct nfs_server *server, const struct nfs_fh *fh,
|
|||
dev->mincount = 0;
|
||||
|
||||
dprintk("%s: dev_id: %s\n", __func__, dev->dev_id.data);
|
||||
rc = nfs4_proc_getdeviceinfo(server, dev);
|
||||
rc = nfs4_proc_getdeviceinfo(server, dev, NULL);
|
||||
dprintk("%s getdevice info returns %d\n", __func__, rc);
|
||||
if (rc) {
|
||||
rv = ERR_PTR(rc);
|
||||
|
|
|
@ -643,7 +643,8 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo,
|
|||
d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode)->pnfs_curr_ld,
|
||||
NFS_SERVER(lo->plh_inode)->nfs_client, id);
|
||||
if (d == NULL) {
|
||||
dsaddr = filelayout_get_device_info(lo->plh_inode, id, gfp_flags);
|
||||
dsaddr = filelayout_get_device_info(lo->plh_inode, id,
|
||||
lo->plh_lc_cred, gfp_flags);
|
||||
if (dsaddr == NULL)
|
||||
goto out;
|
||||
} else
|
||||
|
|
|
@ -150,6 +150,7 @@ struct nfs4_pnfs_ds *nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg,
|
|||
extern void nfs4_fl_put_deviceid(struct nfs4_file_layout_dsaddr *dsaddr);
|
||||
extern void nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr);
|
||||
struct nfs4_file_layout_dsaddr *
|
||||
filelayout_get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags);
|
||||
filelayout_get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id,
|
||||
struct rpc_cred *cred, gfp_t gfp_flags);
|
||||
|
||||
#endif /* FS_NFS_NFS4FILELAYOUT_H */
|
||||
|
|
|
@ -668,7 +668,10 @@ decode_and_add_device(struct inode *inode, struct pnfs_device *dev, gfp_t gfp_fl
|
|||
* of available devices, and return it.
|
||||
*/
|
||||
struct nfs4_file_layout_dsaddr *
|
||||
filelayout_get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags)
|
||||
filelayout_get_device_info(struct inode *inode,
|
||||
struct nfs4_deviceid *dev_id,
|
||||
struct rpc_cred *cred,
|
||||
gfp_t gfp_flags)
|
||||
{
|
||||
struct pnfs_device *pdev = NULL;
|
||||
u32 max_resp_sz;
|
||||
|
@ -709,7 +712,7 @@ filelayout_get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gf
|
|||
pdev->pglen = max_resp_sz;
|
||||
pdev->mincount = 0;
|
||||
|
||||
rc = nfs4_proc_getdeviceinfo(server, pdev);
|
||||
rc = nfs4_proc_getdeviceinfo(server, pdev, cred);
|
||||
dprintk("%s getdevice info returns %d\n", __func__, rc);
|
||||
if (rc)
|
||||
goto out_free;
|
||||
|
|
|
@ -6547,7 +6547,9 @@ int nfs4_proc_getdevicelist(struct nfs_server *server,
|
|||
EXPORT_SYMBOL_GPL(nfs4_proc_getdevicelist);
|
||||
|
||||
static int
|
||||
_nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev)
|
||||
_nfs4_proc_getdeviceinfo(struct nfs_server *server,
|
||||
struct pnfs_device *pdev,
|
||||
struct rpc_cred *cred)
|
||||
{
|
||||
struct nfs4_getdeviceinfo_args args = {
|
||||
.pdev = pdev,
|
||||
|
@ -6559,6 +6561,7 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev)
|
|||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETDEVICEINFO],
|
||||
.rpc_argp = &args,
|
||||
.rpc_resp = &res,
|
||||
.rpc_cred = cred,
|
||||
};
|
||||
int status;
|
||||
|
||||
|
@ -6569,14 +6572,16 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev)
|
|||
return status;
|
||||
}
|
||||
|
||||
int nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev)
|
||||
int nfs4_proc_getdeviceinfo(struct nfs_server *server,
|
||||
struct pnfs_device *pdev,
|
||||
struct rpc_cred *cred)
|
||||
{
|
||||
struct nfs4_exception exception = { };
|
||||
int err;
|
||||
|
||||
do {
|
||||
err = nfs4_handle_exception(server,
|
||||
_nfs4_proc_getdeviceinfo(server, pdev),
|
||||
_nfs4_proc_getdeviceinfo(server, pdev, cred),
|
||||
&exception);
|
||||
} while (exception.retry);
|
||||
return err;
|
||||
|
|
|
@ -614,7 +614,8 @@ int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay,
|
|||
pd.pglen = PAGE_SIZE;
|
||||
pd.mincount = 0;
|
||||
|
||||
err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd);
|
||||
err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd,
|
||||
pnfslay->plh_lc_cred);
|
||||
dprintk("%s nfs_getdeviceinfo returned %d\n", __func__, err);
|
||||
if (err)
|
||||
goto err_out;
|
||||
|
|
|
@ -170,7 +170,8 @@ extern int nfs4_proc_getdevicelist(struct nfs_server *server,
|
|||
const struct nfs_fh *fh,
|
||||
struct pnfs_devicelist *devlist);
|
||||
extern int nfs4_proc_getdeviceinfo(struct nfs_server *server,
|
||||
struct pnfs_device *dev);
|
||||
struct pnfs_device *dev,
|
||||
struct rpc_cred *cred);
|
||||
extern struct pnfs_layout_segment* nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags);
|
||||
extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp);
|
||||
|
||||
|
|
Loading…
Reference in a new issue