kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg.freemyer@gmail.com (Greg Freemyer)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Blocking the access to the device files.
Date: Wed, 29 Dec 2010 14:02:13 -0500	[thread overview]
Message-ID: <AANLkTimOkKTR1-HC_be9Nz1DJKrvZJ5LV8_cd5GUyF0J@mail.gmail.com> (raw)
In-Reply-To: <201012300024.12230.mindentropy@gmail.com>

On Wed, Dec 29, 2010 at 1:54 PM, mindentropy <mindentropy@gmail.com> wrote:
> On Wednesday 29 Dec 2010 10:31:37 pm Greg Freemyer wrote:
>> On Wed, Dec 29, 2010 at 11:12 AM, Mulyadi Santosa
>>
>> <mulyadi.santosa@gmail.com> wrote:
>> > On Wed, Dec 29, 2010 at 20:06, Prasad Joshi <prasadjoshi124@gmail.com>
> 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

  parent reply	other threads:[~2010-12-29 19:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-29 13:06 Blocking the access to the device files Prasad Joshi
2010-12-29 16:12 ` Mulyadi Santosa
2010-12-29 17:01   ` Greg Freemyer
2010-12-29 18:06     ` Mulyadi Santosa
2010-12-29 18:54     ` mindentropy
2010-12-29 19:00       ` Mulyadi Santosa
2010-12-29 19:02       ` Greg Freemyer [this message]
2010-12-29 19:07         ` Mulyadi Santosa
2010-12-29 19:09           ` Greg Freemyer
2010-12-29 23:32   ` Prasad Joshi
2010-12-30  0:07     ` Greg Freemyer
2010-12-30  0:24     ` Henry Gebhardt
2010-12-30  7:10       ` Rajat Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimOkKTR1-HC_be9Nz1DJKrvZJ5LV8_cd5GUyF0J@mail.gmail.com \
    --to=greg.freemyer@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).