linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: set no_llseek in stat_fops_per_vm
@ 2017-05-06 15:37 Geliang Tang
  2017-05-06 15:37 ` [PATCH] powerpc/cell: set no_llseek in spufs_cntl_fops Geliang Tang
  2017-05-09  9:46 ` [PATCH] KVM: set no_llseek in stat_fops_per_vm Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: Geliang Tang @ 2017-05-06 15:37 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář
  Cc: Geliang Tang, kvm, linux-kernel

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>
---
 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[] = {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] powerpc/cell: set no_llseek in spufs_cntl_fops
  2017-05-06 15:37 [PATCH] KVM: set no_llseek in stat_fops_per_vm Geliang Tang
@ 2017-05-06 15:37 ` Geliang Tang
  2019-07-08  1:19   ` Michael Ellerman
  2017-05-09  9:46 ` [PATCH] KVM: set no_llseek in stat_fops_per_vm Paolo Bonzini
  1 sibling, 1 reply; 4+ messages in thread
From: Geliang Tang @ 2017-05-06 15:37 UTC (permalink / raw)
  To: Jeremy Kerr, Arnd Bergmann, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman
  Cc: Geliang Tang, linuxppc-dev, linux-kernel

In spufs_cntl_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>
---
 arch/powerpc/platforms/cell/spufs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index ae2f740..738ef8d 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -456,7 +456,7 @@ static const struct file_operations spufs_cntl_fops = {
 	.release = spufs_cntl_release,
 	.read = simple_attr_read,
 	.write = simple_attr_write,
-	.llseek	= generic_file_llseek,
+	.llseek	= no_llseek,
 	.mmap = spufs_cntl_mmap,
 };
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: set no_llseek in stat_fops_per_vm
  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
@ 2017-05-09  9:46 ` Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-05-09  9:46 UTC (permalink / raw)
  To: Geliang Tang, Radim Krčmář; +Cc: kvm, linux-kernel



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[] = {
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/cell: set no_llseek in spufs_cntl_fops
  2017-05-06 15:37 ` [PATCH] powerpc/cell: set no_llseek in spufs_cntl_fops Geliang Tang
@ 2019-07-08  1:19   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-07-08  1:19 UTC (permalink / raw)
  To: Geliang Tang, Jeremy Kerr, Arnd Bergmann, Benjamin Herrenschmidt,
	Paul Mackerras
  Cc: Geliang Tang, linuxppc-dev, linux-kernel

On Sat, 2017-05-06 at 15:37:20 UTC, Geliang Tang wrote:
> In spufs_cntl_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>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/658829dfe75c49e879e0c4c9cbcd3bd1e4fbdcf5

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-08  1:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH] KVM: set no_llseek in stat_fops_per_vm Paolo Bonzini

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).