Date: Tue, 1 Dec 2009 14:30:31 -0700 (MST) From: Scott Long <scottl@samsco.org> To: Jaakko Heinonen <jh@freebsd.org> Cc: scsi@freebsd.org Subject: Re: cd(4) M_WAITOK allocations with periph lock held Message-ID: <20091201142930.I99667@pooker.samsco.org> In-Reply-To: <20091201180524.GB7961@a91-153-117-195.elisa-laajakaista.fi> References: <20091201180524.GB7961@a91-153-117-195.elisa-laajakaista.fi>
next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-2138113359-1259703031=:99667 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed How about the attached match instead. It refactors the code so that unlocks aren't needed. Scott On Tue, 1 Dec 2009, Jaakko Heinonen wrote: > > Hi, > > There are some M_WAITOK malloc invocations with periph lock held in > cd(4). Below is a link to a patch which drops the periph lock while > doing those allocations. Comments/review? > > --- > > Drop periph lock while allocating memory with M_WAITOK flag in > cdreportkey(), cdsendkey() and cdreaddvdstructure(). > > PR: kern/130735 > Tested by: Eygene Ryabinkin > > The patch against head: > > http://people.freebsd.org/~jh/patches/scsi_cd-M_WAITOK-fixes.diff > > -- > Jaakko > _______________________________________________ > freebsd-scsi@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-scsi > To unsubscribe, send any mail to "freebsd-scsi-unsubscribe@freebsd.org" > --0-2138113359-1259703031=:99667 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=scsi_cd.c.WAITOK.diff Content-Transfer-Encoding: BASE64 Content-ID: <20091201143031.W99667@pooker.samsco.org> Content-Description: Content-Disposition: attachment; filename=scsi_cd.c.WAITOK.diff SW5kZXg6IHNjc2lfY2QuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KUkNT IGZpbGU6IC91c3IxL25jdnMvc3JjL3N5cy9jYW0vc2NzaS9zY3NpX2NkLmMs dg0KcmV0cmlld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Nhc2UgRFZEX1NUUlVDVF9MSVNUOg0KIAkJLyoNCiAJCSAqIFRo aXMgaXMgdGhlIG1heGltdW0gYWxsb2NhdGlvbiBsZW5ndGggZm9yIHRoZSBS RUFEIERWRA0KQEAgLTQwNjcsOSArNDAzNiw3IEBADQogCQlsZW5ndGggPSA2 NTUzNTsNCiAJCWJyZWFrOw0KIAlkZWZhdWx0Og0KLQkJZXJyb3IgPSBFSU5W QUw7DQotCQlnb3RvIGJhaWxvdXQ7DQotCQlicmVhazsgLyogTk9UUkVBQ0hF RCAqLw0KKwkJcmV0dXJuIChFSU5WQUwpOw0KIAl9DQogDQogCWlmIChsZW5n dGggIT0gMCkgew0KQEAgLTQwNzcsNiArNDA0NCw5IEBADQogCX0gZWxzZQ0K IAkJZGF0YWJ1ZiA9IE5VTEw7DQogDQorCWNhbV9wZXJpcGhfbG9jayhwZXJp cGgpOw0KKwljY2IgPSBjZGdldGNjYihwZXJpcGgsIENBTV9QUklPUklUWV9O T1JNQUwpOw0KKw0KIAlzY3NpX3JlYWRfZHZkX3N0cnVjdHVyZSgmY2NiLT5j c2lvLA0KIAkJCQkvKiByZXRyaWVzICovIDEsDQogCQkJCS8qIGNiZmNucCAq LyBjZGRvbmUsDQpAQCAtNDE2NiwxMSArNDEzNiwxMiBAQA0KIAl9DQogYmFp bG91dDoNCiANCisJeHB0X3JlbGVhc2VfY2NiKGNjYik7DQorCWNhbV9wZXJp cGhfdW5sb2NrKHBlcmlwaCk7DQorDQogCWlmIChkYXRhYnVmICE9IE5VTEwp DQogCQlmcmVlKGRhdGFidWYsIE1fREVWQlVGKTsNCiANCi0JeHB0X3JlbGVh c2VfY2NiKGNjYik7DQotDQogCXJldHVybihlcnJvcik7DQogfQ0KIA0K --0-2138113359-1259703031=:99667--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091201142930.I99667>