mirror of https://gitee.com/openkylin/linux.git
NFS client bugfixes for Linux 3.19
Highlights include: - Stable fix for a NFSv3/lockd race - Fixes for several NFSv4.1 client id trunking bugs - Remove an incorrect test when checking for delegated opens -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJUuSAcAAoJEGcL54qWCgDyVGkQAJTTzJ8TcuDaXPz7a+8vYR/F 0Z0iJ7Q2VzfVwLKReQdSMUhX8E6OsVe/HlmFT1paNdIOnF7gQvTclP7/GZ/EaDtA csBKkEcxoCRbF6OhCdeSMJC+iXs0cugCgYrkusPSGJj8dG+qa6Hix8rDfZKbM4yp sQphMozeI/FLHlckBTsViBCECcyR1FxjOrpXc1RPTz1u2dw9dDgZABdX00ubve2Y 5dGIGyriFUiZzqFp+7GLXa2GITuLnda+IPPywyzF2MQy4XYWH63bXoWbyXL3kzQ7 P7hLsGMOfl+pFOBnwYyXhhfqdsS/lOt8V+18Rrr1NhFx7VtQUae/VDPwLxnnoq0P ZtYiuJmIihzHfr4N5V2QR9TcuNO7fg6/1hxHZkOYxaYkH2IezFRWbtj9J/UJS+8q XDQzEvXMxtXCHKDQvmW653oQIdCFRR9YvgsN/YaxIB3vWPKL2tupeQWe/ZEdVvX3 WemIxyc6NBS86otauVXOIKZFgiJ4mynpgH22xb43CJ33b049vJVu/NOQWHgrhHqQ 7vpNDvpjyErjtoMVdN/x2L21uVTucZDXF59hfUD/Q9kE5qXGDRlqiFsDbkVvd+0C SXKBngtslBvgU3dYblAuJ9uMkTYkSE/vNkzVibPXJr4/cysVyMeeRDysVPHRZpw2 8jH+yyHBxvK8XSDTxIkh =hz4r -----END PGP SIGNATURE----- Merge tag 'nfs-for-3.19-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs Pull NFS client bugfixes from Trond Myklebust: "Highlights include: - Stable fix for a NFSv3/lockd race - Fixes for several NFSv4.1 client id trunking bugs - Remove an incorrect test when checking for delegated opens" * tag 'nfs-for-3.19-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: NFSv4: Remove incorrect check in can_open_delegated() NFS: Ignore transport protocol when detecting server trunking NFSv4/v4.1: Verify the client owner id during trunking detection NFSv4: Cache the NFSv4/v4.1 client owner_id in the struct nfs_client NFSv4.1: Fix client id trunking on Linux LOCKD: Fix a race when initialising nlmsvc_timeout
This commit is contained in:
commit
a2a32cd1d7
|
@ -138,10 +138,6 @@ lockd(void *vrqstp)
|
|||
|
||||
dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");
|
||||
|
||||
if (!nlm_timeout)
|
||||
nlm_timeout = LOCKD_DFLT_TIMEO;
|
||||
nlmsvc_timeout = nlm_timeout * HZ;
|
||||
|
||||
/*
|
||||
* The main request loop. We don't terminate until the last
|
||||
* NFS mount or NFS daemon has gone away.
|
||||
|
@ -350,6 +346,10 @@ static struct svc_serv *lockd_create_svc(void)
|
|||
printk(KERN_WARNING
|
||||
"lockd_up: no pid, %d users??\n", nlmsvc_users);
|
||||
|
||||
if (!nlm_timeout)
|
||||
nlm_timeout = LOCKD_DFLT_TIMEO;
|
||||
nlmsvc_timeout = nlm_timeout * HZ;
|
||||
|
||||
serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, svc_rpcb_cleanup);
|
||||
if (!serv) {
|
||||
printk(KERN_WARNING "lockd_up: create service failed\n");
|
||||
|
|
|
@ -228,6 +228,7 @@ static void nfs4_shutdown_client(struct nfs_client *clp)
|
|||
kfree(clp->cl_serverowner);
|
||||
kfree(clp->cl_serverscope);
|
||||
kfree(clp->cl_implid);
|
||||
kfree(clp->cl_owner_id);
|
||||
}
|
||||
|
||||
void nfs4_free_client(struct nfs_client *clp)
|
||||
|
@ -452,6 +453,14 @@ static void nfs4_swap_callback_idents(struct nfs_client *keep,
|
|||
spin_unlock(&nn->nfs_client_lock);
|
||||
}
|
||||
|
||||
static bool nfs4_match_client_owner_id(const struct nfs_client *clp1,
|
||||
const struct nfs_client *clp2)
|
||||
{
|
||||
if (clp1->cl_owner_id == NULL || clp2->cl_owner_id == NULL)
|
||||
return true;
|
||||
return strcmp(clp1->cl_owner_id, clp2->cl_owner_id) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* nfs40_walk_client_list - Find server that recognizes a client ID
|
||||
*
|
||||
|
@ -483,9 +492,6 @@ int nfs40_walk_client_list(struct nfs_client *new,
|
|||
if (pos->rpc_ops != new->rpc_ops)
|
||||
continue;
|
||||
|
||||
if (pos->cl_proto != new->cl_proto)
|
||||
continue;
|
||||
|
||||
if (pos->cl_minorversion != new->cl_minorversion)
|
||||
continue;
|
||||
|
||||
|
@ -510,6 +516,9 @@ int nfs40_walk_client_list(struct nfs_client *new,
|
|||
if (pos->cl_clientid != new->cl_clientid)
|
||||
continue;
|
||||
|
||||
if (!nfs4_match_client_owner_id(pos, new))
|
||||
continue;
|
||||
|
||||
atomic_inc(&pos->cl_count);
|
||||
spin_unlock(&nn->nfs_client_lock);
|
||||
|
||||
|
@ -566,20 +575,14 @@ static bool nfs4_match_clientids(struct nfs_client *a, struct nfs_client *b)
|
|||
}
|
||||
|
||||
/*
|
||||
* Returns true if the server owners match
|
||||
* Returns true if the server major ids match
|
||||
*/
|
||||
static bool
|
||||
nfs4_match_serverowners(struct nfs_client *a, struct nfs_client *b)
|
||||
nfs4_check_clientid_trunking(struct nfs_client *a, struct nfs_client *b)
|
||||
{
|
||||
struct nfs41_server_owner *o1 = a->cl_serverowner;
|
||||
struct nfs41_server_owner *o2 = b->cl_serverowner;
|
||||
|
||||
if (o1->minor_id != o2->minor_id) {
|
||||
dprintk("NFS: --> %s server owner minor IDs do not match\n",
|
||||
__func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (o1->major_id_sz != o2->major_id_sz)
|
||||
goto out_major_mismatch;
|
||||
if (memcmp(o1->major_id, o2->major_id, o1->major_id_sz) != 0)
|
||||
|
@ -621,9 +624,6 @@ int nfs41_walk_client_list(struct nfs_client *new,
|
|||
if (pos->rpc_ops != new->rpc_ops)
|
||||
continue;
|
||||
|
||||
if (pos->cl_proto != new->cl_proto)
|
||||
continue;
|
||||
|
||||
if (pos->cl_minorversion != new->cl_minorversion)
|
||||
continue;
|
||||
|
||||
|
@ -654,7 +654,19 @@ int nfs41_walk_client_list(struct nfs_client *new,
|
|||
if (!nfs4_match_clientids(pos, new))
|
||||
continue;
|
||||
|
||||
if (!nfs4_match_serverowners(pos, new))
|
||||
/*
|
||||
* Note that session trunking is just a special subcase of
|
||||
* client id trunking. In either case, we want to fall back
|
||||
* to using the existing nfs_client.
|
||||
*/
|
||||
if (!nfs4_check_clientid_trunking(pos, new))
|
||||
continue;
|
||||
|
||||
/* Unlike NFSv4.0, we know that NFSv4.1 always uses the
|
||||
* uniform string, however someone might switch the
|
||||
* uniquifier string on us.
|
||||
*/
|
||||
if (!nfs4_match_client_owner_id(pos, new))
|
||||
continue;
|
||||
|
||||
atomic_inc(&pos->cl_count);
|
||||
|
|
|
@ -1117,8 +1117,6 @@ static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode)
|
|||
return 0;
|
||||
if ((delegation->type & fmode) != fmode)
|
||||
return 0;
|
||||
if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags))
|
||||
return 0;
|
||||
if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags))
|
||||
return 0;
|
||||
nfs_mark_delegation_referenced(delegation);
|
||||
|
@ -4917,11 +4915,14 @@ static void nfs4_init_boot_verifier(const struct nfs_client *clp,
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
nfs4_init_nonuniform_client_string(const struct nfs_client *clp,
|
||||
nfs4_init_nonuniform_client_string(struct nfs_client *clp,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
unsigned int result;
|
||||
|
||||
if (clp->cl_owner_id != NULL)
|
||||
return strlcpy(buf, clp->cl_owner_id, len);
|
||||
|
||||
rcu_read_lock();
|
||||
result = scnprintf(buf, len, "Linux NFSv4.0 %s/%s %s",
|
||||
clp->cl_ipaddr,
|
||||
|
@ -4930,24 +4931,32 @@ nfs4_init_nonuniform_client_string(const struct nfs_client *clp,
|
|||
rpc_peeraddr2str(clp->cl_rpcclient,
|
||||
RPC_DISPLAY_PROTO));
|
||||
rcu_read_unlock();
|
||||
clp->cl_owner_id = kstrdup(buf, GFP_KERNEL);
|
||||
return result;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
nfs4_init_uniform_client_string(const struct nfs_client *clp,
|
||||
nfs4_init_uniform_client_string(struct nfs_client *clp,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
const char *nodename = clp->cl_rpcclient->cl_nodename;
|
||||
unsigned int result;
|
||||
|
||||
if (clp->cl_owner_id != NULL)
|
||||
return strlcpy(buf, clp->cl_owner_id, len);
|
||||
|
||||
if (nfs4_client_id_uniquifier[0] != '\0')
|
||||
return scnprintf(buf, len, "Linux NFSv%u.%u %s/%s",
|
||||
result = scnprintf(buf, len, "Linux NFSv%u.%u %s/%s",
|
||||
clp->rpc_ops->version,
|
||||
clp->cl_minorversion,
|
||||
nfs4_client_id_uniquifier,
|
||||
nodename);
|
||||
return scnprintf(buf, len, "Linux NFSv%u.%u %s",
|
||||
else
|
||||
result = scnprintf(buf, len, "Linux NFSv%u.%u %s",
|
||||
clp->rpc_ops->version, clp->cl_minorversion,
|
||||
nodename);
|
||||
clp->cl_owner_id = kstrdup(buf, GFP_KERNEL);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -74,6 +74,9 @@ struct nfs_client {
|
|||
/* idmapper */
|
||||
struct idmap * cl_idmap;
|
||||
|
||||
/* Client owner identifier */
|
||||
const char * cl_owner_id;
|
||||
|
||||
/* Our own IP address, as a null-terminated string.
|
||||
* This is used to generate the mv0 callback address.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue