linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to best return errors on follow_link
@ 2009-05-18 17:30 Steve French
  2009-05-18 17:42 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2009-05-18 17:30 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-cifs-client@lists.samba.org

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to best return errors on follow_link
  2009-05-18 17:30 How to best return errors on follow_link Steve French
@ 2009-05-18 17:42 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2009-05-18 17:42 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-cifs-client@lists.samba.org

On Mon, May 18, 2009 at 12:30 PM, Steve French <smfrench@gmail.com> wrote:
> 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
> Is it ok to return errors on follow_link - seems strange to return
> them indicectly via set_link?

Sorry about the typo indecently was supposed to be "indirectly"
(return errors on set_link)    :)



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-18 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-18 17:30 How to best return errors on follow_link Steve French
2009-05-18 17:42 ` Steve French

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).