Re: [SCSI] fix scsi_reap_target() device_del from atomic context

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

 



James Bottomley <James.Bottomley@xxxxxxxxxxxx> wrote:
>
> > Perhaps you could use work_struct.data for the scsi_target* and get back to
> > the work_struct via container_of().
> 
> Could you elaborate some more on this?  If I simply use the starget
> pointer as my work_struct.data, how do I get back to the actual
> work_struct for me to free it?  It's not passed in to the function as
> far as I can tell.  But even if I do this, I still have to manage the
> allocation and deallocation of the work_struct.
> 

err, no, I'm full of it.  container_of() does pointer arithmetic to convert
a pointer to foo.bar into a pointer to foo.  But in this case the callback
would have the value of work_struct.data, not the address of it, so it
cannot be done.

Most usage in drivers would be something like:

struct driver_thing {
	...
	struct work_struct work;
};

and driver_thing.work.data gets a driver_thing* put into it.  So the need
to separately kmalloc the work_struct+data wrapper is relatively unusual.
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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