From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail203.messagelabs.com (mail203.messagelabs.com [216.82.254.243]) by kanga.kvack.org (Postfix) with SMTP id 83FC96B00FE for ; Wed, 3 Jun 2009 14:17:45 -0400 (EDT) From: "Eric W. Biederman" Date: Mon, 1 Jun 2009 14:50:47 -0700 Message-Id: <1243893048-17031-22-git-send-email-ebiederm@xmission.com> In-Reply-To: References: Subject: [PATCH 22/23] vfs: Teach fadvice to file_hotplug_lock Sender: owner-linux-mm@kvack.org To: Al Viro Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Hugh Dickins , Tejun Heo , Alexey Dobriyan , Linus Torvalds , Alan Cox , Greg Kroah-Hartman , Nick Piggin , Andrew Morton , Christoph Hellwig , "Eric W. Biederman" , "Eric W. Biederman" List-ID: From: Eric W. Biederman Signed-off-by: Eric W. Biederman --- mm/fadvise.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/mm/fadvise.c b/mm/fadvise.c index 54a0f80..d7f1fba 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c @@ -38,6 +38,11 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) if (!file) return -EBADF; + ret = -EIO; + if (!file_hotplug_read_trylock(file)) + goto out_fput; + + ret = 0; if (S_ISFIFO(file->f_path.dentry->d_inode->i_mode)) { ret = -ESPIPE; goto out; @@ -123,6 +128,8 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) ret = -EINVAL; } out: + file_hotplug_read_unlock(file); +out_fput: fput(file); return ret; } -- 1.6.3.1.54.g99dd.dirty -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org