From 90d96ee62f4af72a742616279def14d3dffff109 Mon Sep 17 00:00:00 2001 From: yury Date: Fri, 8 Jul 2005 07:29:45 +0000 Subject: [PATCH] - using push_ctxt() and pop_ctxt() when setting uid/gid in filter_create_object() at Alex's suggest. --- lustre/obdfilter/filter.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index bc1f0ff..7e7953a 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -2315,13 +2315,13 @@ int filter_create_object(struct obd_device *obd, obd_gr group, { struct dentry *dparent = NULL; struct dentry *dchild = NULL; + struct lvfs_ucred uc = {0,}; + struct lvfs_run_ctxt saved; struct filter_obd *filter; int cleanup_phase = 0; int err = 0, rc = 0; void *handle = NULL; void *lock = NULL; - obd_uid ouid; - obd_gid ogid; ENTRY; filter = &obd->u.filter; @@ -2355,23 +2355,15 @@ int filter_create_object(struct obd_device *obd, obd_gr group, GOTO(cleanup, rc = PTR_ERR(handle)); cleanup_phase = 3; - /* making ll_vfs_create() to use passed @uid and @gid */ - if (uid) { - ouid = current->fsuid; - current->fsuid = uid; - } - if (gid) { - ogid = current->fsgid; - current->fsgid = gid; - } + uc.luc_uid = uid; + uc.luc_gid = gid; + uc.luc_fsuid = uid; + uc.luc_fsgid = gid; + push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc); rc = ll_vfs_create(dparent->d_inode, dchild, S_IFREG, NULL); + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc); - if (uid) - current->fsuid = ouid; - if (gid) - current->fsgid = ogid; - if (rc) { CERROR("create failed rc = %d\n", rc); GOTO(cleanup, rc); -- 1.8.3.1