Re: [PATCH] scsi: add non-sleeping variant of scsi_device_put() and use it in alua

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/24/23 13:07, mwilck@xxxxxxxx wrote:
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1426b9b03612..eec52bb298a7 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -576,6 +576,24 @@ int scsi_device_get(struct scsi_device *sdev)
  }
  EXPORT_SYMBOL(scsi_device_get);
+/**
+ * scsi_device_put_nosleep  -  release a reference to a scsi_device
+ * @sdev:	device to release a reference on.
+ *
+ * Description: Release a reference to the scsi_device and decrements the use
+ * count of the underlying LLDD module. This function may only be called from
+ * a call context where it is certain that the reference dropped is not the
+ * last one.
+ */
+void scsi_device_put_nosleep(struct scsi_device *sdev)
+{
+	struct module *mod = sdev->host->hostt->module;
+
+	put_device(&sdev->sdev_gendev);
+	module_put(mod);
+}
+EXPORT_SYMBOL(scsi_device_put);

+EXPORT_SYMBOL(scsi_device_put_nosleep);


otherwise I get:

  CC [M]  drivers/scsi/scsi.o
In file included from ./include/linux/linkage.h:7,
                 from ./include/linux/preempt.h:10,
                 from ./arch/s390/include/asm/timex.h:13,
                 from ./include/linux/timex.h:67,
                 from ./include/linux/time32.h:13,
                 from ./include/linux/time.h:60,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:13,
                 from drivers/scsi/scsi.c:41:
./include/linux/export.h:57:43: error: redefinition of ‘__ksymtab_scsi_device_put’
   57 |         static const struct kernel_symbol __ksymtab_##sym               \
      |                                           ^~~~~~~~~~
./include/linux/export.h:96:9: note: in expansion of macro ‘__KSYMTAB_ENTRY’
   96 |         __KSYMTAB_ENTRY(sym, sec)
      |         ^~~~~~~~~~~~~~~
./include/linux/export.h:140:41: note: in expansion of macro ‘___EXPORT_SYMBOL’
  140 | #define __EXPORT_SYMBOL(sym, sec, ns)   ___EXPORT_SYMBOL(sym, sec, ns)
      |                                         ^~~~~~~~~~~~~~~~
./include/linux/export.h:147:41: note: in expansion of macro ‘__EXPORT_SYMBOL’
  147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
      |                                         ^~~~~~~~~~~~~~~
./include/linux/export.h:150:41: note: in expansion of macro ‘_EXPORT_SYMBOL’
  150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
      |                                         ^~~~~~~~~~~~~~
drivers/scsi/scsi.c:611:1: note: in expansion of macro ‘EXPORT_SYMBOL’
  611 | EXPORT_SYMBOL(scsi_device_put);
      | ^~~~~~~~~~~~~
./include/linux/export.h:57:43: note: previous definition of ‘__ksymtab_scsi_device_put’ with type ‘const struct kernel_symbol’
   57 |         static const struct kernel_symbol __ksymtab_##sym               \
      |                                           ^~~~~~~~~~
./include/linux/export.h:96:9: note: in expansion of macro ‘__KSYMTAB_ENTRY’
   96 |         __KSYMTAB_ENTRY(sym, sec)
      |         ^~~~~~~~~~~~~~~
./include/linux/export.h:140:41: note: in expansion of macro ‘___EXPORT_SYMBOL’
  140 | #define __EXPORT_SYMBOL(sym, sec, ns)   ___EXPORT_SYMBOL(sym, sec, ns)
      |                                         ^~~~~~~~~~~~~~~~
./include/linux/export.h:147:41: note: in expansion of macro ‘__EXPORT_SYMBOL’
  147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
      |                                         ^~~~~~~~~~~~~~~
./include/linux/export.h:150:41: note: in expansion of macro ‘_EXPORT_SYMBOL’
  150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
      |                                         ^~~~~~~~~~~~~~
drivers/scsi/scsi.c:595:1: note: in expansion of macro ‘EXPORT_SYMBOL’
  595 | EXPORT_SYMBOL(scsi_device_put);
      | ^~~~~~~~~~~~~



--
Mit freundlichen Gruessen / Kind regards
Steffen Maier

Linux on IBM Z and LinuxONE

https://www.ibm.com/privacy/us/en/
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschaeftsfuehrung: David Faller
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux