Commit 515788fa authored by Chuck Lever's avatar Chuck Lever
Browse files

lockd: Add LOCKD_SHARE_SVID constant for DOS sharing mode



Replace the magic value ~(u32)0 with a named constant. This value
is used as a synthetic svid when looking up lockowners for DOS
share operations, which have no real process ID associated with
them.

Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent b201ce7a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@
#ifndef _LOCKD_SHARE_H
#define _LOCKD_SHARE_H

/* Synthetic svid for lockowner lookup during share operations */
#define LOCKD_SHARE_SVID	(~(u32)0)

/*
 * DOS share for a specific file
 */
+2 −2
Original line number Diff line number Diff line
@@ -985,7 +985,7 @@ static __be32 nlm4svc_proc_share(struct svc_rqst *rqstp)
	struct nlm4_lock xdr_lock = {
		.fh		= argp->xdrgen.share.fh,
		.oh		= argp->xdrgen.share.oh,
		.svid		= ~(u32)0,
		.svid		= LOCKD_SHARE_SVID,
	};

	resp->xdrgen.cookie = argp->xdrgen.cookie;
@@ -1051,7 +1051,7 @@ static __be32 nlm4svc_proc_unshare(struct svc_rqst *rqstp)
	struct nlm4_lock xdr_lock = {
		.fh		= argp->xdrgen.share.fh,
		.oh		= argp->xdrgen.share.oh,
		.svid		= ~(u32)0,
		.svid		= LOCKD_SHARE_SVID,
	};
	struct nlm_host	*host = NULL;
	struct nlm_file	*file = NULL;
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <uapi/linux/nfs2.h>

#include "lockd.h"
#include "share.h"
#include "svcxdr.h"

static inline loff_t
@@ -274,7 +275,7 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)

	memset(lock, 0, sizeof(*lock));
	locks_init_lock(&lock->fl);
	lock->svid = ~(u32)0;
	lock->svid = LOCKD_SHARE_SVID;

	if (!svcxdr_decode_cookie(xdr, &argp->cookie))
		return false;