* @force: flush all entries, otherwise only free ones be flushed.
*/
static
-int flush_credcache(struct ptlrpc_sec *sec, uid_t uid,
+int flush_credcache(struct ptlrpc_sec *sec, unsigned long pag, uid_t uid,
int grace, int force)
{
struct ptlrpc_cred *cred, *n;
pc_hash) {
LASSERT(atomic_read(&cred->pc_refcount) >= 0);
- if (uid != -1 && uid != cred->pc_uid)
- continue;
+ if (sec->ps_flags & PTLRPC_SEC_FL_PAG) {
+ if (pag != -1 && pag != cred->pc_pag)
+ continue;
+ } else {
+ if (uid != -1 && uid != cred->pc_uid)
+ continue;
+ }
+
if (atomic_read(&cred->pc_refcount)) {
busy = 1;
if (!force)
struct vfs_cred vcred;
LASSERT(sec);
- /* XXX
- * for now we simply let PAG == real uid
- */
+
if (sec->ps_flags & (PTLRPC_SEC_FL_MDS | PTLRPC_SEC_FL_REVERSE)) {
vcred.vc_pag = 0;
vcred.vc_uid = 0;
} else {
- vcred.vc_pag = (__u64) current->uid;
+ if (sec->ps_flags & PTLRPC_SEC_FL_PAG)
+ vcred.vc_pag = (__u64) current->pag;
+ else
+ vcred.vc_pag = (__u64) current->uid;
vcred.vc_uid = current->uid;
}
int ncred;
if (atomic_dec_and_test(&sec->ps_refcount)) {
- flush_credcache(sec, -1, 1, 1);
+ flush_credcache(sec, -1, -1, 1, 1);
/* this spinlock is protect against ptlrpcs_cred_destroy() */
spin_lock(&sec->ps_lock);
void ptlrpcs_sec_invalidate_cache(struct ptlrpc_sec *sec)
{
- flush_credcache(sec, -1, 0, 1);
+ flush_credcache(sec, -1, -1, 0, 1);
}
int sec_alloc_reqbuf(struct ptlrpc_sec *sec,
RETURN(0);
/* find actual flavor for client obd. right now server side
- * obd (reverse imp, etc) will simply use NULL.
- */
- if (!strcmp(imp->imp_obd->obd_type->typ_name, "mdc") ||
- !strcmp(imp->imp_obd->obd_type->typ_name, "osc")) {
+ * obd (reverse imp, etc) will simply use NULL. */
+ if (!strcmp(imp->imp_obd->obd_type->typ_name, OBD_MDC_DEVICENAME) ||
+ !strcmp(imp->imp_obd->obd_type->typ_name, OBD_OSC_DEVICENAME)) {
struct client_obd *cli = &imp->imp_obd->u.cli;
switch (SEC_FLAVOR_MAJOR(cli->cl_sec_flavor)) {
pipedir = imp->imp_obd->obd_name;
break;
default:
- CWARN("unknown security flavor for %s(%s), use null\n",
+ CWARN("unknown security flavor for %s(%s), "
+ "use null\n",
imp->imp_obd->obd_type->typ_name,
imp->imp_obd->obd_name);
}
EXIT;
}
-void ptlrpcs_import_flush_creds(struct obd_import *imp, uid_t uid)
+void ptlrpcs_import_flush_current_creds(struct obd_import *imp)
{
LASSERT(imp);
class_import_get(imp);
if (imp->imp_sec)
- flush_credcache(imp->imp_sec, uid, 1, 1);
+ flush_credcache(imp->imp_sec, current->pag, current->uid, 1, 1);
class_import_put(imp);
}
EXPORT_SYMBOL(ptlrpcs_sec_invalidate_cache);
EXPORT_SYMBOL(ptlrpcs_import_get_sec);
EXPORT_SYMBOL(ptlrpcs_import_drop_sec);
-EXPORT_SYMBOL(ptlrpcs_import_flush_creds);
+EXPORT_SYMBOL(ptlrpcs_import_flush_current_creds);
EXPORT_SYMBOL(ptlrpcs_cred_lookup);
EXPORT_SYMBOL(ptlrpcs_cred_put);
EXPORT_SYMBOL(ptlrpcs_req_get_cred);