forked from luck/tmp_suning_uos_patched
NFS: Fix O_DIRECT verifier problems
We should not be interested in looking at the value of the stable field, since that could take any value. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
6712007734
commit
8fc3c38627
|
@ -196,6 +196,12 @@ static void nfs_direct_set_hdr_verf(struct nfs_direct_req *dreq,
|
|||
WARN_ON_ONCE(verfp->committed < 0);
|
||||
}
|
||||
|
||||
static int nfs_direct_cmp_verf(const struct nfs_writeverf *v1,
|
||||
const struct nfs_writeverf *v2)
|
||||
{
|
||||
return nfs_write_verifier_cmp(&v1->verifier, &v2->verifier);
|
||||
}
|
||||
|
||||
/*
|
||||
* nfs_direct_cmp_hdr_verf - compare verifier for pgio header
|
||||
* @dreq - direct request possibly spanning multiple servers
|
||||
|
@ -215,7 +221,7 @@ static int nfs_direct_set_or_cmp_hdr_verf(struct nfs_direct_req *dreq,
|
|||
nfs_direct_set_hdr_verf(dreq, hdr);
|
||||
return 0;
|
||||
}
|
||||
return memcmp(verfp, &hdr->verf, sizeof(struct nfs_writeverf));
|
||||
return nfs_direct_cmp_verf(verfp, &hdr->verf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -238,7 +244,7 @@ static int nfs_direct_cmp_commit_data_verf(struct nfs_direct_req *dreq,
|
|||
if (verfp->committed < 0)
|
||||
return 1;
|
||||
|
||||
return memcmp(verfp, &data->verf, sizeof(struct nfs_writeverf));
|
||||
return nfs_direct_cmp_verf(verfp, &data->verf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -506,6 +506,13 @@ extern int nfs_migrate_page(struct address_space *,
|
|||
#define nfs_migrate_page NULL
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
nfs_write_verifier_cmp(const struct nfs_write_verifier *v1,
|
||||
const struct nfs_write_verifier *v2)
|
||||
{
|
||||
return memcmp(v1->data, v2->data, sizeof(v1->data));
|
||||
}
|
||||
|
||||
/* unlink.c */
|
||||
extern struct rpc_task *
|
||||
nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
|
||||
|
|
|
@ -1789,7 +1789,7 @@ static void nfs_commit_release_pages(struct nfs_commit_data *data)
|
|||
|
||||
/* Okay, COMMIT succeeded, apparently. Check the verifier
|
||||
* returned by the server against all stored verfs. */
|
||||
if (!memcmp(&req->wb_verf, &data->verf.verifier, sizeof(req->wb_verf))) {
|
||||
if (!nfs_write_verifier_cmp(&req->wb_verf, &data->verf.verifier)) {
|
||||
/* We have a match */
|
||||
nfs_inode_remove_request(req);
|
||||
dprintk(" OK\n");
|
||||
|
|
Loading…
Reference in New Issue
Block a user