linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Geliang Tang" <geliangtang@gmail.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: set no_llseek in stat_fops_per_vm
Date: Tue, 9 May 2017 11:46:19 +0200	[thread overview]
Message-ID: <498cdd0d-1f9b-4a58-e789-9a9dfe2880fe@redhat.com> (raw)
In-Reply-To: <ad61d4443d93fcfb442bd6367eefde3e04201bef.1493801155.git.geliangtang@gmail.com>



On 06/05/2017 17:37, Geliang Tang wrote:
> In vm_stat_get_per_vm_fops and vcpu_stat_get_per_vm_fops, since we
> use nonseekable_open() to open, we should use no_llseek() to seek,
> not generic_file_llseek().
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

This is not strictly necessary, nonseekable_open bypasses f_op->llseek
due to this code in vfs_llseek:

        fn = no_llseek;
        if (file->f_mode & FMODE_LSEEK) {
                if (file->f_op->llseek)
                        fn = file->f_op->llseek;
        }
        return fn(file, offset, whence);

But it's a good thing to do anyway, so I'm applying it.

Paolo

> ---
>  virt/kvm/kvm_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index c2bb6ab..798f567 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -3689,7 +3689,7 @@ static const struct file_operations vm_stat_get_per_vm_fops = {
>  	.release = kvm_debugfs_release,
>  	.read    = simple_attr_read,
>  	.write   = simple_attr_write,
> -	.llseek  = generic_file_llseek,
> +	.llseek  = no_llseek,
>  };
>  
>  static int vcpu_stat_get_per_vm(void *data, u64 *val)
> @@ -3734,7 +3734,7 @@ static const struct file_operations vcpu_stat_get_per_vm_fops = {
>  	.release = kvm_debugfs_release,
>  	.read    = simple_attr_read,
>  	.write   = simple_attr_write,
> -	.llseek  = generic_file_llseek,
> +	.llseek  = no_llseek,
>  };
>  
>  static const struct file_operations *stat_fops_per_vm[] = {
> 

      parent reply	other threads:[~2017-05-09  9:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-06 15:37 [PATCH] KVM: set no_llseek in stat_fops_per_vm Geliang Tang
2017-05-06 15:37 ` [PATCH] powerpc/cell: set no_llseek in spufs_cntl_fops Geliang Tang
2019-07-08  1:19   ` Michael Ellerman
2017-05-09  9:46 ` Paolo Bonzini [this message]

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=498cdd0d-1f9b-4a58-e789-9a9dfe2880fe@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=geliangtang@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    /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).