From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754085AbdEIJqZ (ORCPT ); Tue, 9 May 2017 05:46:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41176 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203AbdEIJqX (ORCPT ); Tue, 9 May 2017 05:46:23 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0A21B72AE2 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0A21B72AE2 Subject: Re: [PATCH] KVM: set no_llseek in stat_fops_per_vm To: Geliang Tang , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: From: Paolo Bonzini Message-ID: <498cdd0d-1f9b-4a58-e789-9a9dfe2880fe@redhat.com> Date: Tue, 9 May 2017 11:46:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 09 May 2017 09:46:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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[] = { >