From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: [RFC][PATCH 10/20] unix_find_other() elevate write count for touch_atime() Date: Fri, 16 Jun 2006 16:12:21 -0700 Message-ID: <20060616231221.F146F36E@localhost.localdomain> References: <20060616231213.D4C5D6AF@localhost.localdomain> Cc: linux-fsdevel@vger.kernel.org, herbert@13thfloor.at, viro@ftp.linux.org.uk, Dave Hansen Return-path: Received: from e4.ny.us.ibm.com ([32.97.182.144]:58064 "EHLO e4.ny.us.ibm.com") by vger.kernel.org with ESMTP id S1751555AbWFPXM0 (ORCPT ); Fri, 16 Jun 2006 19:12:26 -0400 To: linux-kernel@vger.kernel.org In-Reply-To: <20060616231213.D4C5D6AF@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Signed-off-by: Dave Hansen --- lxc-dave/net/unix/af_unix.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff -puN net/unix/af_unix.c~C-elevate-writers-opens-part4 net/unix/af_unix.c --- lxc/net/unix/af_unix.c~C-elevate-writers-opens-part4 2006-06-16 15:58:05.000000000 -0700 +++ lxc-dave/net/unix/af_unix.c 2006-06-16 15:58:05.000000000 -0700 @@ -676,21 +676,27 @@ static struct sock *unix_find_other(stru err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd); if (err) goto fail; + + err = mnt_want_write(nd.mnt); + if (err) + goto put_path_fail; + err = vfs_permission(&nd, MAY_WRITE); if (err) - goto put_fail; + goto mnt_drop_write_fail; err = -ECONNREFUSED; if (!S_ISSOCK(nd.dentry->d_inode->i_mode)) - goto put_fail; + goto mnt_drop_write_fail; u=unix_find_socket_byinode(nd.dentry->d_inode); if (!u) - goto put_fail; + goto mnt_drop_write_fail; if (u->sk_type == type) touch_atime(nd.mnt, nd.dentry); path_release(&nd); + mnt_drop_write(nd.mnt); err=-EPROTOTYPE; if (u->sk_type != type) { @@ -710,7 +716,9 @@ static struct sock *unix_find_other(stru } return u; -put_fail: +mnt_drop_write_fail: + mnt_drop_write(nd.mnt); +put_path_fail: path_release(&nd); fail: *error=err; _