linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	viro@zeniv.linux.org.uk, hch@infradead.org,
	tyhicks@canonical.com, ecryptfs@vger.kernel.org
Subject: Re: [PATCH 3/4] ecryptfs: add fadvise/set_flags calbacks
Date: Sun, 19 Oct 2014 07:50:25 -0700	[thread overview]
Message-ID: <20141019145025.GA9593@infradead.org> (raw)
In-Reply-To: <1413645688-13524-4-git-send-email-dmonakhov@openvz.org>

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.

  reply	other threads:[~2014-10-19 14:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-18 15:21 [PATCH 0/4] fs: fcntl/fadvice fixes v2 Dmitry Monakhov
2014-10-18 15:21 ` [PATCH 1/4] fs: fcntl add set_flags wrapper -v2 Dmitry Monakhov
2014-10-18 15:21 ` [PATCH 2/4] fs: add fadvise file_operation Dmitry Monakhov
2014-10-19 14:51   ` Christoph Hellwig
2014-10-21  8:31     ` Dmitry Monakhov
2014-10-18 15:21 ` [PATCH 3/4] ecryptfs: add fadvise/set_flags calbacks Dmitry Monakhov
2014-10-19 14:50   ` Christoph Hellwig [this message]
2014-10-18 15:21 ` [PATCH 4/4] cifs: add set_flag callback Dmitry Monakhov

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=20141019145025.GA9593@infradead.org \
    --to=hch@infradead.org \
    --cc=dmonakhov@openvz.org \
    --cc=ecryptfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tyhicks@canonical.com \
    --cc=viro@zeniv.linux.org.uk \
    /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).