Re: [PATCH 10/22][RFC] Unionfs: Inode operations

From: Jan Engelhardt
Date: Mon Sep 04 2006 - 03:19:33 EST



>+ //DQ: vfs_create has a different prototype in 2.6

I found a relic! :-)

>+ if (IS_ERR(hidden_dentry)) {
>+ err = PTR_ERR(hidden_dentry);
>+ }
-{}

>+/* We don't lock the dentry here, because readlink does the heavy lifting. */
>+static void *unionfs_follow_link(struct dentry *dentry, struct nameidata *nd)
>+{
>+ char *buf;
>+ int len = PAGE_SIZE, err;
>+ mm_segment_t old_fs;
>+
>+ /* This is freed by the put_link method assuming a successful call. */
>+ buf = (char *)kmalloc(len, GFP_KERNEL);

Nocast.

>+void unionfs_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
>+{
>+ char *link;
>+ link = nd_get_link(nd);
>+ kfree(link);
>+}

kfree(nd_get_link(nd));

>+ /* Ordinary permission routines do not understand MAY_APPEND. */
>+ submask = mask & ~MAY_APPEND;
>+ if (inode->i_op && inode->i_op->permission) {
>+ retval = inode->i_op->permission(inode, submask, nd);
>+ if ((retval == -EACCES) && (submask & MAY_WRITE) &&
>+ (!strcmp("nfs", (inode)->i_sb->s_type->name)) &&
>+ (nd) && (nd->mnt) && (nd->mnt->mnt_sb) &&
>+ (branchperms(nd->mnt->mnt_sb, bindex) & MAY_NFSRO)) {
>+ retval = generic_permission(inode, submask, NULL);

I am not sure right now, I would need to test; does someone know out of the box
whether other network filesystems (in particular SMBFS/CIFS) behave like NFS
and also return -EACCES rather than -EROFS?

>+ return ((retval == -EROFS) ? 0 : retval); /* ignore EROFS */
outer ()
>+ for (bindex = bstart; (bindex <= bend) || (bindex == bstart); bindex++) {

>+ /* if error is in the leftmost f/s, pass it up */

"f/s" => branch, to follow unionfs terminiology.



Jan Engelhardt
--

--
VGER BF report: H 0.0311395
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/