RE: Write-protect checks

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

 



On Thu, 8 Dec 2005, Fiala, Stefan wrote:

> The flag is set when the kernel/module is loaded.

No it isn't.

> For all but removeable the device must disappear/reappear
> Which fixes the flag.

No it doesn't.  The flag does not get set if the media is not removable.  
Here's the code from sd.c:sd_revalidate_disk():

	if (sdkp->media_present) {
		sd_read_capacity(sdkp, disk->disk_name, buffer);
		if (sdp->removable)
			sd_read_write_protect_flag(sdkp, disk->disk_name,
						   buffer);
		sd_read_cache_type(sdkp, disk->disk_name, buffer);
	}

That's the only place where sd_read_write_protect_flag gets called, so it 
never is called if sdp->removable is clear.

> Leaving removeables, that on user interaction, can change.
> For instance:
> On an RW-optical [use sd], eject current cartridge, flip wrt-prot tab,
> Re-insert. Unless a user were accessing during this sequence
> [sounds painful] the state of the WP bit would silently change.
> Hence the revalidate on open if its removeable.

Alan Stern

-
: 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