Re: Is request_firmware() really safe to call in resume callback when /usr/lib/firmware is on btrfs?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 08, 2021 at 06:02:24PM +0000, Luis Chamberlain wrote:
> On Sat, Apr 03, 2021 at 08:25:38PM +0000, Luis Chamberlain wrote:
> > So creating say 1000 random files in /lib/firmware on a freshly created
> > btrfs partition helps reproduce:
> > 
> > mkfs.btrfs /dev/whatever
> > mount /dev/wahtever /lib/firmware
> > # Put it on /etc/fstab too
> > 
> > Generate 1000 random files on it:
> > 
> > ```
> > for n in {1..1000}; do                                                          
> >     dd if=/dev/urandom of=/lib/firmware/file$( printf %03d "$n" ).bin bs=1 count=$((RANDOM + 1024 ))
> > done  
> > ```
> > 
> > Then reboot, upon reboot do:
> > 
> > modprobe test_firmware
> > echo 1 > /sys/devices/virtual/misc/test_firmware/config_enable_resume_test
> > systemctl suspend
> > 
> > If its a guest wake it up:
> > 
> > virsh dompmwakeup domidofguest
> 
> This happens because:
> 
> btrfs_lookup() --> ... -->                                                      
> btrfs_search_slot() --> read_block_for_search() -->                             
> 	--> read_tree_block() --> btree_read_extent_buffer_pages() -->                
> 	--> submit_one_bio() --> btrfs_submit_metadata_bio() -->                      
> 	--> btrfsic_submit_bio() --> submit_bio()
> 		--> this completes and then
> 	--> wait_on_page_locked() on the first page
> 	--> never returns                                                             
> 
> I also managed to reproduce this easily with XFS as well, so this is not
> a btrfs thing as I suspected. It does not happen with ext4 though.
> However I think that's just by chance, it should still be prone to the
> same issue.
> 
> Either way, I'm dusting off my patches for fs freeze as I believe that
> should fix this problem. I am not sure if we want a stop gap hack like
> the one I posted in the meantime... I don't think so. I rather fix this
> well with the series I'll post for fs freeze. Give me a bit of time and
> I'll CC you on the patches.

Low and behold, as I suspectd, my old VFS fsfreeze / thaw patch series
this. However I should note that I needed to add remove also the
WQ_FREEZABLE from fs as well, which was missing in my patch series, and
which Jan Kara had pointed out.

However, the VFS freeze work is quite a bit of work which we are still
discussing, so in the meantime, I think we have no other option but
to put the stop-gap patch I suggested with the usermode helper lock.
I will just modify it a bit more.

I'll also post my fs freeze work now again, but I'll note that it
still requires some more work to address everything which we have
discussed in the community. I'll post the patches as I think others
may be interested in the progress of that.

  Luis



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux