linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Cc: "linux-cifs-client@lists.samba.org" <linux-cifs-client@lists.samba.org>
Subject: How to best return errors on follow_link
Date: Mon, 18 May 2009 12:30:10 -0500	[thread overview]
Message-ID: <524f69650905181030x6206e818yadc45eaae288e4ef@mail.gmail.com> (raw)

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

             reply	other threads:[~2009-05-18 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18 17:30 Steve French [this message]
2009-05-18 17:42 ` How to best return errors on follow_link Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=524f69650905181030x6206e818yadc45eaae288e4ef@mail.gmail.com \
    --to=smfrench@gmail.com \
    --cc=linux-cifs-client@lists.samba.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).