From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Smith Subject: [PATCH 12/19] c/r: introduce vfs_fcntl() Date: Tue, 14 Dec 2010 08:15:00 -0800 Message-ID: <1292343307-7870-12-git-send-email-danms@us.ibm.com> References: <1292343307-7870-1-git-send-email-danms@us.ibm.com> Cc: linux-fsdevel@vger.kernel.org, Oren Laadan To: danms@us.ibm.com Return-path: Received: from stein.danplanet.com ([71.245.107.83]:34421 "EHLO orion.danplanet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753550Ab0LNQYK (ORCPT ); Tue, 14 Dec 2010 11:24:10 -0500 In-Reply-To: <1292343307-7870-1-git-send-email-danms@us.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Oren Laadan This patch introduces vfs_fcntl() so that it can be called from restart (see patch adding restart of files). Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Oren Laadan Acked-by: Serge E. Hallyn Tested-by: Serge E. Hallyn --- fs/fcntl.c | 21 +++++++++++++-------- include/linux/fs.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/fs/fcntl.c b/fs/fcntl.c index ecc8b39..8e797b7 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -426,6 +426,18 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, return err; } +int vfs_fcntl(int fd, unsigned int cmd, unsigned long arg, struct file *filp) +{ + int err; + + err = security_file_fcntl(filp, cmd, arg); + if (err) + goto out; + err = do_fcntl(fd, cmd, arg, filp); + out: + return err; +} + SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) { struct file *filp; @@ -435,14 +447,7 @@ SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) if (!filp) goto out; - err = security_file_fcntl(filp, cmd, arg); - if (err) { - fput(filp); - return err; - } - - err = do_fcntl(fd, cmd, arg, filp); - + err = vfs_fcntl(fd, cmd, arg, filp); fput(filp); out: return err; diff --git a/include/linux/fs.h b/include/linux/fs.h index 12cc2e6..b0f8706 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1111,6 +1111,8 @@ struct file_lock { #include +extern int vfs_fcntl(int fd, unsigned cmd, unsigned long arg, struct file *fp); + extern void send_sigio(struct fown_struct *fown, int fd, int band); #ifdef CONFIG_FILE_LOCKING -- 1.7.2.2