From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756997Ab3CUGLW (ORCPT ); Thu, 21 Mar 2013 02:11:22 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:51735 "EHLO e7.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752996Ab3CUGLU (ORCPT ); Thu, 21 Mar 2013 02:11:20 -0400 Date: Thu, 21 Mar 2013 11:36:40 +0530 From: Srikar Dronamraju To: Oleg Nesterov Cc: Al Viro , Anton Arapov , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] uprobes: Use file_inode() Message-ID: <20130321060640.GB17874@linux.vnet.ibm.com> Reply-To: Srikar Dronamraju References: <20130317180036.GA16843@redhat.com> <20130317182550.GD21522@ZenIV.linux.org.uk> <20130317184255.GA23280@redhat.com> <20130318184317.GA8423@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20130318184317.GA8423@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13032106-5806-0000-0000-0000206C50A2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Oleg Nesterov [2013-03-18 19:43:17]: > Cleanup. Now that we have f_inode/file_inode() we can use it instead > of ->f_mapping->host. > > This should not make any difference for uprobes, but in theory this > change is more correct. We use this inode as a key, to compare it > with uprobe->inode set by uprobe_register(inode), and the caller uses > d_inode. > > Signed-off-by: Oleg Nesterov Looks good to me. Acked-by: Srikar Dronamraju > --- > kernel/events/uprobes.c | 10 +++++----- > 1 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c > index 2bcd08e..5c273b3 100644 > --- a/kernel/events/uprobes.c > +++ b/kernel/events/uprobes.c > @@ -758,7 +758,7 @@ register_for_each_vma(struct uprobe *uprobe, struct uprobe_consumer *new) > down_write(&mm->mmap_sem); > vma = find_vma(mm, info->vaddr); > if (!vma || !valid_vma(vma, is_register) || > - vma->vm_file->f_mapping->host != uprobe->inode) > + file_inode(vma->vm_file) != uprobe->inode) > goto unlock; > > if (vma->vm_start > info->vaddr || > @@ -917,7 +917,7 @@ static int unapply_uprobe(struct uprobe *uprobe, struct mm_struct *mm) > loff_t offset; > > if (!valid_vma(vma, false) || > - vma->vm_file->f_mapping->host != uprobe->inode) > + file_inode(vma->vm_file) != uprobe->inode) > continue; > > offset = (loff_t)vma->vm_pgoff << PAGE_SHIFT; > @@ -1010,7 +1010,7 @@ int uprobe_mmap(struct vm_area_struct *vma) > if (no_uprobe_events() || !valid_vma(vma, true)) > return 0; > > - inode = vma->vm_file->f_mapping->host; > + inode = file_inode(vma->vm_file); > if (!inode) > return 0; > > @@ -1041,7 +1041,7 @@ vma_has_uprobes(struct vm_area_struct *vma, unsigned long start, unsigned long e > struct inode *inode; > struct rb_node *n; > > - inode = vma->vm_file->f_mapping->host; > + inode = file_inode(vma->vm_file); > > min = vaddr_to_offset(vma, start); > max = min + (end - start) - 1; > @@ -1465,7 +1465,7 @@ static struct uprobe *find_active_uprobe(unsigned long bp_vaddr, int *is_swbp) > vma = find_vma(mm, bp_vaddr); > if (vma && vma->vm_start <= bp_vaddr) { > if (valid_vma(vma, false)) { > - struct inode *inode = vma->vm_file->f_mapping->host; > + struct inode *inode = file_inode(vma->vm_file); > loff_t offset = vaddr_to_offset(vma, bp_vaddr); > > uprobe = find_uprobe(inode, offset); > -- > 1.5.5.1 > > -- Thanks and Regards Srikar Dronamraju