Re: [PATCH 1/2] Add partition resize function to BLKPG ioctl

From: Phillip Susi
Date: Sun Jan 01 2012 - 16:49:32 EST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/29/2011 07:09 PM, Phillip Susi wrote:
> Good points. I also noticed that the read/write functions were only
> being called when not holding the mutex. If anyone is touching
> nr_sects without the mutex, then everyone must use the read/write
> functions, whether they hold the mutex or not. Otherwise, a mutex
> holder that touches it directly will race with a non mutex holder
> using the seqcounter. Vivek, rather than fix the rest of the
> references to nr_sects to use the read/write functions, why not just
> fix the few sites that were accessing it without the mutex to take
> the mutex fist instead of using a seqcounter?

I've been wondering why device-mapper and loop have been able to change device size for years, yet didn't add a seqcounter to do this. It looks to me like there are plenty of places ( like xen-blkback ) that either call get_capacity() or directly reference nr_sects without holding the bd_mutex. Does this mean that device-mapper or loop changing capacity on i386 with large block support already has a race condition?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPANTRAAoJEJrBOlT6nu75FjAIAMR6B/Q4o8VDdZGIMw7RoutP
MHdCFPwcxTjc06061E2oRk4NYHGQFhg9NfKK6vmI2enjB+ctVIFyK2qC+Ar13mUp
KkKbqrVbjOM8AOXgEb4VTQMQ6inTUFEvTOx+EGvAw0flJzpfq7zdjw+1P+BM/PrY
LPhxjb8dPeooHmv2TEFFpW0XavkqBM1JHuL9sM2f2g3U9QKU3clNFnrHGY7p1Wxn
FBO2ncqqSdbJKsw2xskdRfMq1x6jXfUeIyXCoNoTrHHPz+80AeHOMWy2Y54dvZMX
J9iKuQlURG5zyQ1eGh96YlRj4f4Z+zFY8h84K3z2i+xR45J4IgNxXD4ewbIPqg8=
=XZQc
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/