Re: linux-next: manual merge of the ecryptfs tree with Linus' tree

From: Tyler Hicks
Date: Mon Jan 17 2011 - 18:12:24 EST


On Sat Jan 15, 2011 at 11:15:35AM +1100, Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
> Hi Tyler,
>
> Today's linux-next merge of the ecryptfs tree got a conflict in
> fs/ecryptfs/main.c between commit
> 66cb76666d69502fe982990b2cff5b6d607fd3b1 ("sanitize ecryptfs ->mount()")
> from Linus' tree and commit c65b788ce32e9cd1c7d221551275774f1aa83084
> ("ecryptfs: missing initialization of the superblock 'magic' field") from
> the ecryptfs tree.
>
> I fixed it up (I think - see below) and can carry the fix as necessary.

Thanks Stephen - I made the same fix up earlier today when preparing a
branch for a pull request to Linus. Linus has completed the pull and
I've updated the eCryptfs next branch accordingly, so you shouldn't see
any merge conflicts today.

Tyler

> --
> Cheers,
> Stephen Rothwell sfr@xxxxxxxxxxxxxxxx
>
> diff --cc fs/ecryptfs/main.c
> index d3b28ab,70009a7..0000000
> --- a/fs/ecryptfs/main.c
> +++ b/fs/ecryptfs/main.c
> @@@ -546,54 -587,34 +546,55 @@@ static struct dentry *ecryptfs_mount(st
> /* ->kill_sb() will take care of sbi after that point */
> sbi = NULL;
> s->s_op = &ecryptfs_sops;
> + s->s_d_op = &ecryptfs_dops;
>
> - rc = -ENOMEM;
> - s->s_root = d_alloc(NULL, &(const struct qstr) {
> - .hash = 0,.name = "/",.len = 1});
> + err = "Reading sb failed";
> + rc = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
> + if (rc) {
> + ecryptfs_printk(KERN_WARNING, "kern_path() failed\n");
> + goto out1;
> + }
> + if (path.dentry->d_sb->s_type == &ecryptfs_fs_type) {
> + rc = -EINVAL;
> + printk(KERN_ERR "Mount on filesystem of type "
> + "eCryptfs explicitly disallowed due to "
> + "known incompatibilities\n");
> + goto out_free;
> + }
> + ecryptfs_set_superblock_lower(s, path.dentry->d_sb);
> + s->s_maxbytes = path.dentry->d_sb->s_maxbytes;
> + s->s_blocksize = path.dentry->d_sb->s_blocksize;
> ++ s->s_magic = ECRYPTFS_SUPER_MAGIC;
> +
> + inode = ecryptfs_get_inode(path.dentry->d_inode, s);
> + rc = PTR_ERR(inode);
> + if (IS_ERR(inode))
> + goto out_free;
> +
> + s->s_root = d_alloc_root(inode);
> if (!s->s_root) {
> - deactivate_locked_super(s);
> - goto out;
> + iput(inode);
> + rc = -ENOMEM;
> + goto out_free;
> }
> - s->s_root->d_op = &ecryptfs_dops;
> - s->s_root->d_sb = s;
> - s->s_root->d_parent = s->s_root;
>
> + rc = -ENOMEM;
> root_info = kmem_cache_zalloc(ecryptfs_dentry_info_cache, GFP_KERNEL);
> - if (!root_info) {
> - deactivate_locked_super(s);
> - goto out;
> - }
> + if (!root_info)
> + goto out_free;
> +
> /* ->kill_sb() will take care of root_info */
> ecryptfs_set_dentry_private(s->s_root, root_info);
> + ecryptfs_set_dentry_lower(s->s_root, path.dentry);
> + ecryptfs_set_dentry_lower_mnt(s->s_root, path.mnt);
> +
> s->s_flags |= MS_ACTIVE;
> - rc = ecryptfs_read_super(s, dev_name);
> - if (rc) {
> - deactivate_locked_super(s);
> - err = "Reading sb failed";
> - goto out;
> - }
> return dget(s->s_root);
>
> +out_free:
> + path_put(&path);
> +out1:
> + deactivate_locked_super(s);
> out:
> if (sbi) {
> ecryptfs_destroy_mount_crypt_stat(&sbi->mount_crypt_stat);
--
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/