________________________________________ From: Bart Van Assche [Bart.VanAssche@xxxxxxx] Sent: Tuesday, August 29, 2017 11:13 AM To: hch@xxxxxxxxxxxxx; Viswas G; Gerry Morong; Mahesh Rajashekhara; POSWALD@xxxxxxxx; Scott Benesh; Don Brace; Bader Ali - Saleh; Kevin Barnett; joseph.szczypek@xxxxxxx; Scott Teel; jejb@xxxxxxxxxxxxxxxxxx; Justin Lindley; John Hall Cc: linux-scsi@xxxxxxxxxxxxxxx Subject: Re: [PATCH] sd: preserve sysfs updates to max_sectors_kb EXTERNAL EMAIL On Tue, 2017-08-29 at 17:42 +0000, Don Brace wrote: > From: Don Brace > > [ ... ] > > Hello Don, > > > > Can you have another look at the udev rules on your test system? The last > > rule in 60-block.rules looks like a watch rule to me. The same holds for the > > upstream version of that file > > (https://github.com/systemd/systemd/blob/maste > > r/rules/60-block.rules). > > > > Bart. > > It is a watch rule. > > systemd/src/udev/udevd.c > manager_new > manager->fd_inotify = udev_watch_init(manager->udev); > sd_event_add_io(manager->event, &manager->inotify_event, manager->fd_inotify, EPOLLIN, on_inotify, manager); > on_inotify (systemd source code: src/udev/udevd.c) > synthesize_change > ioctl --> BLKRRPART > > This rule ends up calling BLKRRPART. Hello Don, Sorry if I'm slow today, but it's not clear to me how the BLKRRPART ioctl triggers a change of max_sectors_kb? And even if it really is this ioctl that triggers a change of max_sectors_kb, should the kernel code that handles max_sectors_kb writes be modified or should rather a udev rule be added that sets max_sectors_kb to the desired value after each partition rescan? Thanks, Bart. ---- BLKRRPART ends up in the sd driver function sd_revalidate_disk, which resets q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q)); back to the value from VPD page 0xb0. When you cat out max_sectors_kb, it obtains it's valuse from q->limits.max_sectors Adding a udev rule... Will there be a delay between the watch rule and the new rule? Thanks, Don Brace