Re: [PATCH 3/4] ecryptfs: add fadvise/set_flags calbacks

From: Christoph Hellwig
Date: Sun Oct 19 2014 - 10:50:30 EST


On Sat, Oct 18, 2014 at 07:21:27PM +0400, Dmitry Monakhov wrote:
> + if (ecryptfs_file_to_private(file))
> + lower_file = ecryptfs_file_to_lower(file);
> +
> + if (!lower_file || !lower_file->f_op)
> + return rc;

At least a file without f->f_op should never happen. How could ecryptfs
not have a lower file here?

>
> +
> + if (lower_file->f_op && lower_file->f_op->fadvise)
> + rc = lower_file->f_op->fadvise(lower_file, offset, len, advice);
> + else
> + rc = generic_fadvise(lower_file, offset, len, advice);

Seems like this should be in a vfs_fadvice helper.

> + if (!rc)
> + generic_fadvise(file, offset, len, advice);

Setting the advice on both files seems odd. Which one do we actually
need them on?

> + if (lower_file->f_op && lower_file->f_op->set_flags) {
> + rc = lower_file->f_op->set_flags(lower_file,
> + flags & ECRYPTFS_FL_MASK);
> + if (rc)
> + return rc;
> + } else
> + generic_file_set_flags(file, flags & ECRYPTFS_FL_MASK);

Seems like you want a vfs_set_flags again.

--
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/