From: Sukadev Bhattiprolu Subject: [PATCH 01/16][cr][v3]: Add uid, euid params to f_modown() Date: Tue, 3 Aug 2010 16:11:22 -0700 Message-ID: <1280877097-12377-2-git-send-email-sukadev@linux.vnet.ibm.com> References: <1280877097-12377-1-git-send-email-sukadev@linux.vnet.ibm.com> Cc: Serge Hallyn , Matt Helsley , Dan Smith , John Stultz , Matthew Wilcox , Jamie Lokier , , Containers To: Oren Laadan Return-path: Received: from e3.ny.us.ibm.com ([32.97.182.143]:39194 "EHLO e3.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757795Ab0HCXGL (ORCPT ); Tue, 3 Aug 2010 19:06:11 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e3.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o73MpKZh021171 for ; Tue, 3 Aug 2010 18:51:20 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o73N6A02376114 for ; Tue, 3 Aug 2010 19:06:10 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o73N6991002306 for ; Tue, 3 Aug 2010 19:06:10 -0400 In-Reply-To: <1280877097-12377-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