From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve French Subject: How to best return errors on follow_link Date: Mon, 18 May 2009 12:30:10 -0500 Message-ID: <524f69650905181030x6206e818yadc45eaae288e4ef@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "linux-cifs-client@lists.samba.org" To: linux-fsdevel Return-path: Received: from yw-out-2324.google.com ([74.125.46.29]:9942 "EHLO yw-out-2324.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751382AbZERRaJ (ORCPT ); Mon, 18 May 2009 13:30:09 -0400 Received: by yw-out-2324.google.com with SMTP id 5so2057922ywb.1 for ; Mon, 18 May 2009 10:30:10 -0700 (PDT) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Jeff noticed a problem with the error handling in cifs_follow_link that brought up a question about how follow_link is supposed to be handling errors. His change has a sideeffect of now returning NULL instead of an ENOMEM on memory allocation errors in cifs_follow_link. The caller of follow_link in the VFS (__do_follow_link) seems to expect errors to be returned (see below piece of fs/namei.c) not a NULL ptr: cookie = dentry->d_inode->i_op->follow_link(dentry, nd); error = PTR_ERR(cookie); if (!IS_ERR(cookie)) { char *s = nd_get_link(nd); error = 0; if (s) error = __vfs_follow_link(nd, s); if (dentry->d_inode->i_op->put_link) dentry->d_inode->i_op->put_link(dentry, nd, cookie); } path_put(path); return error; Some file systems rather than returning an error to the caller will call nd_set_link while will set: nd->saved_names[nd->depth] = to the error; Is it ok to return errors on follow_link - seems strange to return them indicectly via set_link? -- Thanks, Steve