From patchwork Wed Jan 5 16:49:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "M. Mohan Kumar" X-Patchwork-Id: 453901 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p05GoZKf021208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 5 Jan 2011 16:50:56 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1PaWYt-0002xX-V2; Wed, 05 Jan 2011 16:50:11 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1PaWYt-0002wo-L8 for v9fs-developer@lists.sourceforge.net; Wed, 05 Jan 2011 16:50:11 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of in.ibm.com designates 202.81.31.145 as permitted sender) client-ip=202.81.31.145; envelope-from=mohan@in.ibm.com; helo=e23smtp03.au.ibm.com; Received: from e23smtp03.au.ibm.com ([202.81.31.145]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) id 1PaWYs-0003Av-8A for v9fs-developer@lists.sourceforge.net; Wed, 05 Jan 2011 16:50:11 +0000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp03.au.ibm.com (8.14.4/8.13.1) with ESMTP id p05Gjfsm032739 for ; Thu, 6 Jan 2011 03:45:41 +1100 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p05Go18w2408472 for ; Thu, 6 Jan 2011 03:50:02 +1100 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p05Go1b8005213 for ; Thu, 6 Jan 2011 03:50:01 +1100 Received: from oc3510633643.ibm.com ([9.77.212.129]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p05Gnx8J005102; Thu, 6 Jan 2011 03:50:00 +1100 From: "M. Mohan Kumar" To: "v9fs-developer" , "linux-fsdevel@vger.kernel.org" , LKML Date: Wed, 5 Jan 2011 22:19:56 +0530 Message-Id: <1294246196-8354-1-git-send-email-mohan@in.ibm.com> X-Mailer: git-send-email 1.7.3.4 X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1PaWYs-0003Av-8A Subject: [V9fs-developer] [PATCH] [V2] fs/9p: TREADLINK bugfix X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 05 Jan 2011 16:50:57 +0000 (UTC) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 2ce3668..7e613e8 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -1994,30 +1994,6 @@ error: return err; } -static int -v9fs_vfs_readlink_dotl(struct dentry *dentry, char *buffer, int buflen) -{ - int retval; - struct p9_fid *fid; - char *target = NULL; - - P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name); - retval = -EPERM; - fid = v9fs_fid_lookup(dentry); - if (IS_ERR(fid)) - return PTR_ERR(fid); - - retval = p9_client_readlink(fid, &target); - if (retval < 0) - return retval; - - strncpy(buffer, target, buflen); - P9_DPRINTK(P9_DEBUG_VFS, "%s -> %s\n", dentry->d_name.name, buffer); - - retval = strnlen(buffer, buflen); - return retval; -} - /** * v9fs_vfs_follow_link_dotl - follow a symlink path * @dentry: dentry for symlink @@ -2028,23 +2004,28 @@ v9fs_vfs_readlink_dotl(struct dentry *dentry, char *buffer, int buflen) static void * v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) { - int len = 0; + int retval; + struct p9_fid *fid; char *link = __getname(); + char *target; - P9_DPRINTK(P9_DEBUG_VFS, "%s n", dentry->d_name.name); + P9_DPRINTK(P9_DEBUG_VFS, "%s\n", dentry->d_name.name); if (!link) - link = ERR_PTR(-ENOMEM); - else { - len = v9fs_vfs_readlink_dotl(dentry, link, PATH_MAX); - if (len < 0) { - __putname(link); - link = ERR_PTR(len); - } else - link[min(len, PATH_MAX-1)] = 0; + return NULL; + fid = v9fs_fid_lookup(dentry); + if (IS_ERR(fid)) + return fid; + retval = p9_client_readlink(fid, &target); + if (retval < 0) { + __putname(link); + kfree(target); + return NULL; } - nd_set_link(nd, link); + strcpy(link, target); + nd_set_link(nd, link); + kfree(target); return NULL; } @@ -2117,7 +2098,7 @@ static const struct inode_operations v9fs_symlink_inode_operations = { }; static const struct inode_operations v9fs_symlink_inode_operations_dotl = { - .readlink = v9fs_vfs_readlink_dotl, + .readlink = generic_readlink, .follow_link = v9fs_vfs_follow_link_dotl, .put_link = v9fs_vfs_put_link, .getattr = v9fs_vfs_getattr_dotl,