From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sukadev Bhattiprolu Subject: [PATCH 01/17][cr][v4]: Add uid, euid params to f_modown() Date: Mon, 16 Aug 2010 12:43:05 -0700 Message-ID: <1281987801-1293-2-git-send-email-sukadev@linux.vnet.ibm.com> References: <1281987801-1293-1-git-send-email-sukadev@linux.vnet.ibm.com> Cc: Serge Hallyn , Matt Helsley , Dan Smith , John Stultz , Matthew Wilcox , Jamie Lokier , Steven Whitehouse , , Containers To: Oren Laadan Return-path: Received: from e39.co.us.ibm.com ([32.97.110.160]:42159 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756237Ab0HPThw (ORCPT ); Mon, 16 Aug 2010 15:37:52 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e39.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o7GJRodS006492 for ; Mon, 16 Aug 2010 13:27:50 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o7GJbXo2131914 for ; Mon, 16 Aug 2010 13:37:38 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o7GJbWCD014758 for ; Mon, 16 Aug 2010 13:37:33 -0600 In-Reply-To: <1281987801-1293-1-git-send-email-sukadev@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Checkpoint/restart of file-owner. Add uid, euid parameters to f_modown(). These parameters will be needed when restarting an application (and hence restoring the file information), from a checkpoint image. Signed-off-by: Sukadev Bhattiprolu --- fs/fcntl.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/fcntl.c b/fs/fcntl.c index 2079af0..aeab1f4 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -197,7 +197,7 @@ static int setfl(int fd, struct file * filp, unsigned long arg) } static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, - int force) + uid_t uid, uid_t euid, int force) { write_lock_irq(&filp->f_owner.lock); if (force || !filp->f_owner.pid) { @@ -206,9 +206,8 @@ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, filp->f_owner.pid_type = type; if (pid) { - const struct cred *cred = current_cred(); - filp->f_owner.uid = cred->uid; - filp->f_owner.euid = cred->euid; + filp->f_owner.uid = uid; + filp->f_owner.euid = euid; } } write_unlock_irq(&filp->f_owner.lock); @@ -223,7 +222,7 @@ int __f_setown(struct file *filp, struct pid *pid, enum pid_type type, if (err) return err; - f_modown(filp, pid, type, force); + f_modown(filp, pid, type, current_uid(), current_euid(), force); return 0; } EXPORT_SYMBOL(__f_setown); @@ -249,7 +248,7 @@ EXPORT_SYMBOL(f_setown); void f_delown(struct file *filp) { - f_modown(filp, NULL, PIDTYPE_PID, 1); + f_modown(filp, NULL, PIDTYPE_PID, current_uid(), current_euid(), 1); } pid_t f_getown(struct file *filp) -- 1.6.0.4