[lkml]   [2009]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: nbd: add locking to nbd_ioctl
    > Pavel Machek wrote:
    > >>Pavel Machek wrote:
    > >>>On Fri 2009-01-16 10:24:06, Paul Clements wrote:
    > >>lo->sock is only modified under tx_lock (except for SET_SOCK, where the
    > >>device is being initialized, in which case it's impossible for any other
    > >>thread to be accessing the device)
    > >
    > >Well, unless the user is evil or confused? :-).
    > Even in that case, you're just going to get EBUSY. Nothing bad will
    > happen. SET_SOCK checks for lo->file, so it cannot be called on an
    > active nbd device.
    > >>As for other fields, I assume you're talking about blksize, et al.
    > >>Taking tx_lock doesn't prevent you from screwing yourself if you modify
    > >>those while the device is active. You'd need to disallow those ioctls
    > >>when the device is active (check lo->file). Again, this is only going to
    > >>happen if you really misuse the ioctls.
    > >
    > >Ok, I'll take a look at the missing checks. I'd really like to make
    > >this "stable" -- no amount of misuse should crash the kernel.
    > Just to summarize, I don't think we need to hold tx_lock around the
    > entirety of nbd_ioctl. We do need one extra tx_lock around xmit_timeout
    > and we do need to check for lo->file and return EBUSY in all of the
    > SET_*SIZE* ioctls.

    I could do that but it would be a bit too complex, and still rely on
    big kernel lock. Would you agree to patch that added tx_lock around
    all of it, and moved ioctl to unlocked ioctl?

    You are right that errors were much less severe than I thought in the

    (cesky, pictures)

     \ /
      Last update: 2009-01-26 17:53    [W:0.021 / U:13.196 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site