From e058c53f7c59814d8a0235afb2d175cb976c341e Mon Sep 17 00:00:00 2001 From: ericm Date: Mon, 29 Aug 2005 20:59:19 +0000 Subject: [PATCH] hack to always use root credential between client and oss. --- lustre/include/linux/lustre_sec.h | 1 + lustre/llite/llite_lib.c | 24 ++++++++++++++++-------- lustre/sec/sec.c | 3 ++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lustre/include/linux/lustre_sec.h b/lustre/include/linux/lustre_sec.h index 5ccafab..56ca8f5 100644 --- a/lustre/include/linux/lustre_sec.h +++ b/lustre/include/linux/lustre_sec.h @@ -281,6 +281,7 @@ struct ptlrpc_sec_type { #define PTLRPC_SEC_FL_MDS 0x0001 /* outgoing from MDS */ #define PTLRPC_SEC_FL_REVERSE 0x0002 /* reverse sec */ #define PTLRPC_SEC_FL_PAG 0x0004 /* enable PAG */ +#define PTLRPC_SEC_FL_OSS 0x0008 /* outgoing to OSS XXX */ #define PTLRPC_CREDCACHE_NR 8 #define PTLRPC_CREDCACHE_MASK (PTLRPC_CREDCACHE_NR - 1) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index fc68447..2b5ff01 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -263,15 +263,23 @@ static int lustre_connect_ost(struct super_block *sb, char *lov, RETURN(err); } - if (pag) { + /* FIXME Because of the async nature of file i/o, we never know + * who is actually dirty the pages; and any process have chance + * to trigger dirty-flushing within its own process context. So + * for simplicity we simply use root's credential, we suppose root + * always have credential. + */ + if (pag) sec_flags = PTLRPC_SEC_FL_PAG; - err = obd_set_info(obd->obd_self_export, - strlen("sec_flags"), "sec_flags", - sizeof(sec_flags), &sec_flags); - if (err) { - OBD_FREE(data, sizeof(*data)); - RETURN(err); - } + else + sec_flags = PTLRPC_SEC_FL_OSS; + + err = obd_set_info(obd->obd_self_export, + strlen("sec_flags"), "sec_flags", + sizeof(sec_flags), &sec_flags); + if (err) { + OBD_FREE(data, sizeof(*data)); + RETURN(err); } err = obd_connect(&dt_conn, obd, &sbi->ll_sb_uuid, data, 0); diff --git a/lustre/sec/sec.c b/lustre/sec/sec.c index a9f4e56..40f892a 100644 --- a/lustre/sec/sec.c +++ b/lustre/sec/sec.c @@ -419,7 +419,8 @@ static struct ptlrpc_cred *get_cred(struct ptlrpc_sec *sec) LASSERT(sec); - if (sec->ps_flags & (PTLRPC_SEC_FL_MDS | PTLRPC_SEC_FL_REVERSE)) { + if (sec->ps_flags & + (PTLRPC_SEC_FL_MDS | PTLRPC_SEC_FL_OSS | PTLRPC_SEC_FL_REVERSE)) { vcred.vc_pag = 0; vcred.vc_uid = 0; } else { -- 1.8.3.1