Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19478
b: refs/heads/master
c: f9bdfa0
h: refs/heads/master
v: v3
  • Loading branch information
Linas Vepstas authored and Linus Torvalds committed Feb 2, 2006
1 parent fd46a50 commit 472ea7e
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 128 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00b464debf0038b1628996065f0be564ccfbfd86
refs/heads/master: f9bdfa0ecb3304e8b7e74862b1f4b03b6feaaeef
3 changes: 3 additions & 0 deletions trunk/arch/powerpc/platforms/pseries/pci_dlpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pcibios_find_pci_bus(struct device_node *dn)

return find_bus_among_children(pdn->phb->bus, dn);
}
EXPORT_SYMBOL_GPL(pcibios_find_pci_bus);

/**
* pcibios_remove_pci_devices - remove all devices under this bus
Expand Down Expand Up @@ -106,6 +107,7 @@ pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus)
}
}
}
EXPORT_SYMBOL_GPL(pcibios_fixup_new_pci_devices);

static int
pcibios_pci_config_bridge(struct pci_dev *dev)
Expand Down Expand Up @@ -172,3 +174,4 @@ pcibios_add_pci_devices(struct pci_bus * bus)
pcibios_pci_config_bridge(dev);
}
}
EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
11 changes: 3 additions & 8 deletions trunk/fs/lockd/clntproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
#define NLMDBG_FACILITY NLMDBG_CLIENT
#define NLMCLNT_GRACE_WAIT (5*HZ)
#define NLMCLNT_POLL_TIMEOUT (30*HZ)
#define NLMCLNT_MAX_RETRIES 3

static int nlmclnt_test(struct nlm_rqst *, struct file_lock *);
static int nlmclnt_lock(struct nlm_rqst *, struct file_lock *);
static int nlmclnt_unlock(struct nlm_rqst *, struct file_lock *);
static int nlm_stat_to_errno(u32 stat);
static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host);
static int nlmclnt_cancel(struct nlm_host *, int , struct file_lock *);

static const struct rpc_call_ops nlmclnt_unlock_ops;
static const struct rpc_call_ops nlmclnt_cancel_ops;
Expand Down Expand Up @@ -600,7 +598,7 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
nlmclnt_finish_block(req);
/* Cancel the blocked request if it is still pending */
if (resp->status == NLM_LCK_BLOCKED)
nlmclnt_cancel(host, req->a_args.block, fl);
nlmclnt_cancel(host, fl);
out:
nlmclnt_release_lockargs(req);
return status;
Expand Down Expand Up @@ -730,7 +728,8 @@ static const struct rpc_call_ops nlmclnt_unlock_ops = {
* We always use an async RPC call for this in order not to hang a
* process that has been Ctrl-C'ed.
*/
static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl)
int
nlmclnt_cancel(struct nlm_host *host, struct file_lock *fl)
{
struct nlm_rqst *req;
unsigned long flags;
Expand All @@ -751,7 +750,6 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl
req->a_flags = RPC_TASK_ASYNC;

nlmclnt_setlockargs(req, fl);
req->a_args.block = block;

status = nlmclnt_async_call(req, NLMPROC_CANCEL, &nlmclnt_cancel_ops);
if (status < 0) {
Expand Down Expand Up @@ -803,9 +801,6 @@ static void nlmclnt_cancel_callback(struct rpc_task *task, void *data)
return;

retry_cancel:
/* Don't ever retry more than 3 times */
if (req->a_retries++ >= NLMCLNT_MAX_RETRIES)
goto die;
nlm_rebind_host(req->a_host);
rpc_restart_call(task);
rpc_delay(task, 30 * HZ);
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static ssize_t nfs_direct_write_seg(struct inode *inode,
if (wdata->verf.committed != NFS_FILE_SYNC) {
need_commit = 1;
if (memcmp(&first_verf.verifier, &wdata->verf.verifier,
sizeof(first_verf.verifier)))
sizeof(first_verf.verifier)));
goto sync_retry;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/lockd/lockd.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ struct nlm_rqst {
struct nlm_args a_args; /* arguments */
struct nlm_res a_res; /* result */
struct nlm_wait * a_block;
unsigned int a_retries; /* Retry count */
char a_owner[NLMCLNT_OHSIZE];
};

Expand Down Expand Up @@ -149,6 +148,7 @@ struct nlm_rqst * nlmclnt_alloc_call(void);
int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl);
void nlmclnt_finish_block(struct nlm_rqst *req);
long nlmclnt_block(struct nlm_rqst *req, long timeout);
int nlmclnt_cancel(struct nlm_host *, struct file_lock *);
u32 nlmclnt_grant(struct nlm_lock *);
void nlmclnt_recovery(struct nlm_host *, u32);
int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
Expand Down
10 changes: 4 additions & 6 deletions trunk/include/linux/sunrpc/auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct rpc_cred {

/* per-flavor data */
};
#define RPCAUTH_CRED_NEW 0x0001
#define RPCAUTH_CRED_LOCKED 0x0001
#define RPCAUTH_CRED_UPTODATE 0x0002

#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0
Expand Down Expand Up @@ -83,10 +83,9 @@ struct rpc_auth {
struct rpc_cred_cache * au_credcache;
/* per-flavor data */
};

/* Flags for rpcauth_lookupcred() */
#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */
#define RPCAUTH_LOOKUP_ROOTCREDS 0x02 /* This really ought to go! */
#define RPC_AUTH_PROC_CREDS 0x0010 /* process creds (including
* uid/gid, fs[ug]id, gids)
*/

/*
* Client authentication ops
Expand All @@ -106,7 +105,6 @@ struct rpc_authops {

struct rpc_credops {
const char * cr_name; /* Name of the auth flavour */
int (*cr_init)(struct rpc_auth *, struct rpc_cred *);
void (*crdestroy)(struct rpc_cred *);

int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
Expand Down
25 changes: 7 additions & 18 deletions trunk/net/sunrpc/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ rpcauth_gc_credcache(struct rpc_auth *auth, struct hlist_head *free)
*/
struct rpc_cred *
rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
int flags)
int taskflags)
{
struct rpc_cred_cache *cache = auth->au_credcache;
HLIST_HEAD(free);
Expand All @@ -193,7 +193,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
*cred = NULL;
int nr = 0;

if (!(flags & RPCAUTH_LOOKUP_ROOTCREDS))
if (!(taskflags & RPC_TASK_ROOTCREDS))
nr = acred->uid & RPC_CREDCACHE_MASK;
retry:
spin_lock(&rpc_credcache_lock);
Expand All @@ -202,7 +202,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
hlist_for_each_safe(pos, next, &cache->hashtable[nr]) {
struct rpc_cred *entry;
entry = hlist_entry(pos, struct rpc_cred, cr_hash);
if (entry->cr_ops->crmatch(acred, entry, flags)) {
if (entry->cr_ops->crmatch(acred, entry, taskflags)) {
hlist_del(&entry->cr_hash);
cred = entry;
break;
Expand All @@ -224,29 +224,21 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
rpcauth_destroy_credlist(&free);

if (!cred) {
new = auth->au_ops->crcreate(auth, acred, flags);
new = auth->au_ops->crcreate(auth, acred, taskflags);
if (!IS_ERR(new)) {
#ifdef RPC_DEBUG
new->cr_magic = RPCAUTH_CRED_MAGIC;
#endif
goto retry;
} else
cred = new;
} else if ((cred->cr_flags & RPCAUTH_CRED_NEW)
&& cred->cr_ops->cr_init != NULL
&& !(flags & RPCAUTH_LOOKUP_NEW)) {
int res = cred->cr_ops->cr_init(auth, cred);
if (res < 0) {
put_rpccred(cred);
cred = ERR_PTR(res);
}
}

return (struct rpc_cred *) cred;
}

struct rpc_cred *
rpcauth_lookupcred(struct rpc_auth *auth, int flags)
rpcauth_lookupcred(struct rpc_auth *auth, int taskflags)
{
struct auth_cred acred = {
.uid = current->fsuid,
Expand All @@ -258,7 +250,7 @@ rpcauth_lookupcred(struct rpc_auth *auth, int flags)
dprintk("RPC: looking up %s cred\n",
auth->au_ops->au_name);
get_group_info(acred.group_info);
ret = auth->au_ops->lookup_cred(auth, &acred, flags);
ret = auth->au_ops->lookup_cred(auth, &acred, taskflags);
put_group_info(acred.group_info);
return ret;
}
Expand All @@ -273,14 +265,11 @@ rpcauth_bindcred(struct rpc_task *task)
.group_info = current->group_info,
};
struct rpc_cred *ret;
int flags = 0;

dprintk("RPC: %4d looking up %s cred\n",
task->tk_pid, task->tk_auth->au_ops->au_name);
get_group_info(acred.group_info);
if (task->tk_flags & RPC_TASK_ROOTCREDS)
flags |= RPCAUTH_LOOKUP_ROOTCREDS;
ret = auth->au_ops->lookup_cred(auth, &acred, flags);
ret = auth->au_ops->lookup_cred(auth, &acred, task->tk_flags);
if (!IS_ERR(ret))
task->tk_msg.rpc_cred = ret;
else
Expand Down
40 changes: 11 additions & 29 deletions trunk/net/sunrpc/auth_gss/auth_gss.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx)
old = gss_cred->gc_ctx;
gss_cred->gc_ctx = ctx;
cred->cr_flags |= RPCAUTH_CRED_UPTODATE;
cred->cr_flags &= ~RPCAUTH_CRED_NEW;
write_unlock(&gss_ctx_lock);
if (old)
gss_put_ctx(old);
Expand Down Expand Up @@ -581,7 +580,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
} else {
struct auth_cred acred = { .uid = uid };
spin_unlock(&gss_auth->lock);
cred = rpcauth_lookup_credcache(clnt->cl_auth, &acred, RPCAUTH_LOOKUP_NEW);
cred = rpcauth_lookup_credcache(clnt->cl_auth, &acred, 0);
if (IS_ERR(cred)) {
err = PTR_ERR(cred);
goto err_put_ctx;
Expand Down Expand Up @@ -759,13 +758,13 @@ gss_destroy_cred(struct rpc_cred *rc)
* Lookup RPCSEC_GSS cred for the current process
*/
static struct rpc_cred *
gss_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
gss_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int taskflags)
{
return rpcauth_lookup_credcache(auth, acred, flags);
return rpcauth_lookup_credcache(auth, acred, taskflags);
}

static struct rpc_cred *
gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int taskflags)
{
struct gss_auth *gss_auth = container_of(auth, struct gss_auth, rpc_auth);
struct gss_cred *cred = NULL;
Expand All @@ -786,8 +785,13 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
*/
cred->gc_flags = 0;
cred->gc_base.cr_ops = &gss_credops;
cred->gc_base.cr_flags = RPCAUTH_CRED_NEW;
cred->gc_service = gss_auth->service;
do {
err = gss_create_upcall(gss_auth, cred);
} while (err == -EAGAIN);
if (err < 0)
goto out_err;

return &cred->gc_base;

out_err:
Expand All @@ -797,34 +801,13 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
}

static int
gss_cred_init(struct rpc_auth *auth, struct rpc_cred *cred)
{
struct gss_auth *gss_auth = container_of(auth, struct gss_auth, rpc_auth);
struct gss_cred *gss_cred = container_of(cred,struct gss_cred, gc_base);
int err;

do {
err = gss_create_upcall(gss_auth, gss_cred);
} while (err == -EAGAIN);
return err;
}

static int
gss_match(struct auth_cred *acred, struct rpc_cred *rc, int flags)
gss_match(struct auth_cred *acred, struct rpc_cred *rc, int taskflags)
{
struct gss_cred *gss_cred = container_of(rc, struct gss_cred, gc_base);

/*
* If the searchflags have set RPCAUTH_LOOKUP_NEW, then
* we don't really care if the credential has expired or not,
* since the caller should be prepared to reinitialise it.
*/
if ((flags & RPCAUTH_LOOKUP_NEW) && (rc->cr_flags & RPCAUTH_CRED_NEW))
goto out;
/* Don't match with creds that have expired. */
if (gss_cred->gc_ctx && time_after(jiffies, gss_cred->gc_ctx->gc_expiry))
return 0;
out:
return (rc->cr_uid == acred->uid);
}

Expand Down Expand Up @@ -1258,7 +1241,6 @@ static struct rpc_authops authgss_ops = {
static struct rpc_credops gss_credops = {
.cr_name = "AUTH_GSS",
.crdestroy = gss_destroy_cred,
.cr_init = gss_cred_init,
.crmatch = gss_match,
.crmarshal = gss_marshal,
.crrefresh = gss_refresh,
Expand Down
6 changes: 3 additions & 3 deletions trunk/net/sunrpc/auth_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)

atomic_set(&cred->uc_count, 1);
cred->uc_flags = RPCAUTH_CRED_UPTODATE;
if (flags & RPCAUTH_LOOKUP_ROOTCREDS) {
if (flags & RPC_TASK_ROOTCREDS) {
cred->uc_uid = 0;
cred->uc_gid = 0;
cred->uc_gids[0] = NOGROUP;
Expand Down Expand Up @@ -108,12 +108,12 @@ unx_destroy_cred(struct rpc_cred *cred)
* request root creds (e.g. for NFS swapping).
*/
static int
unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int taskflags)
{
struct unx_cred *cred = (struct unx_cred *) rcred;
int i;

if (!(flags & RPCAUTH_LOOKUP_ROOTCREDS)) {
if (!(taskflags & RPC_TASK_ROOTCREDS)) {
int groups;

if (cred->uc_uid != acred->uid
Expand Down
Loading

0 comments on commit 472ea7e

Please sign in to comment.