From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg.freemyer@gmail.com (Greg Freemyer) Date: Wed, 29 Dec 2010 14:02:13 -0500 Subject: Blocking the access to the device files. In-Reply-To: <201012300024.12230.mindentropy@gmail.com> References: <201012300024.12230.mindentropy@gmail.com> Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Wed, Dec 29, 2010 at 1:54 PM, mindentropy wrote: > On Wednesday 29 Dec 2010 10:31:37 pm Greg Freemyer wrote: >> On Wed, Dec 29, 2010 at 11:12 AM, Mulyadi Santosa >> >> wrote: >> > On Wed, Dec 29, 2010 at 20:06, Prasad Joshi > wrote: >> >> Hello All, >> >> >> >> ZFS file system has a property called devices. If turned off, ZFS >> >> would not allow access to the device files (block/character) present >> >> on the file system. I want to implement the same behavior on the a >> >> Linux File System. >> > >> > I don't know about ZFS, so could you please elaborate on what you mean >> > by "ZFS could disallow access"? >> > >> > IMHO, (untested), you could simply do it using usual Linux >> > file/directory permission up to SELinux/AppArmor....so, is that what >> > you mean? >> > >> > -- >> > regards, >> > >> > Mulyadi Santosa >> >> Mulyadi, >> >> My guess is that it is more complex than that. >> >> Some filesystems have issues if the raw drive is read while the >> filesystem is mounted. ?I think it is caused by inconsistencies in the >> various cache's. ?ie. iirc, At least in the 2.4 kernel there was not a >> single unified cache for block layer and filesystems. ?So doing raw >> reads of underlying device while it was mounted could cause the caches >> to get out of sync. >> >> I don't recall the details, but either the kernel would oops or the >> filesystem would become corrupt. ?I don't know if any 2.6 filesystems >> still have that issue. ?Anyway ZFS must have a similar issue. >> >> So a ZFS filesystem developer knowing this was a conflict could add a >> check in the /dev/sda open() that would fail the open if there was a >> mounted filesystem of type ZFS on the drive. >> >> And the mount should fail if /dev/sda is already open. >> >> I'm not aware of the 2.6.x linux kernel offering any infrastructure to >> help with that issue. >> >> Greg >> >> _______________________________________________ >> Kernelnewbies mailing list >> Kernelnewbies at kernelnewbies.org >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > Greg, >> So doing raw >> reads of underlying device while it was mounted could cause the caches >> to get out of sync. > > ? ?So doing a 'dd' would cause the kernel to oops? > > Thanks. I really don't remember what the problem was. It was about 2003 or 2004 I think that I came across the issue. I don't recall if it was XFS or ext2/3 or what. I just know I came to the conclusion that dd if=/dev/sda of=/dev/null was not always safe if the drive had a mounted filesystem. Hopefully its been fixed by now. Greg