From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751788AbcBLXZw (ORCPT ); Fri, 12 Feb 2016 18:25:52 -0500 Received: from mta02.ornl.gov ([128.219.177.12]:15082 "EHLO mta02.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750852AbcBLXZu convert rfc822-to-8bit (ORCPT ); Fri, 12 Feb 2016 18:25:50 -0500 X-SG: RELAYLIST X-IronPort-AV: E=Sophos;i="5.22,437,1449550800"; d="scan'208";a="97816340" From: "Simmons, James A." To: "'Greg Kroah-Hartman'" , James Simmons CC: "devel@driverdev.osuosl.org" , "Parinay Kondekar" , James Simmons , Linux Kernel Mailing List , Oleg Drokin , "lustre-devel@lists.lustre.org" Subject: RE: [lustre-devel] [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release] Thread-Topic: [lustre-devel] [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release] Thread-Index: AQHRXtPqMlLEorP5nEaxEcpz5Dkb658pF5iA Date: Fri, 12 Feb 2016 23:16:02 +0000 Message-ID: <7d92389fd1ca47abb762b460f4d9b7b6@EXCHCS32.ornl.gov> References: <1452022519-6716-1-git-send-email-jsimmons@infradead.org> <1452022519-6716-6-git-send-email-jsimmons@infradead.org> <20160203224035.GA10529@kroah.com> In-Reply-To: <20160203224035.GA10529@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [128.219.12.132] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c >> index 33f6036..64f0fbf 100644 >> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c >> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c >> @@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size) >> static int >> libcfs_psdev_open(struct inode *inode, struct file *file) >> { >> - int rc = 0; >> - >> if (!inode) >> return -EINVAL; >> - if (libcfs_psdev_ops.p_open != NULL) >> - rc = libcfs_psdev_ops.p_open(0, NULL); >> - else >> - return -EPERM; >> - return rc; >> + >> + try_module_get(THIS_MODULE); > >Note, code like this is racy and incorrect and never needed, please fix >this up properly (hint, set the module in the file operations.) > >Again, if you ever see code with that line, it is incorrect. So simple static struct file_operations libcfs_fops = { .module = THIS_MODULE, .unlocked_ioctl = libcfs_psdev_ioctl, }; With the open and release deleted should do the trick then.