The same issue exists in g_io_speedup() (though that function appears to be unused at the moment).
Tue, Nov 3
Oct 5 2020
Sep 29 2020
Sep 22 2020
It might be that brelse/bqrelse should also assert that the flag is cleared, but there I am not that sure.
Sep 21 2020
Would it make sense to put this clearing of B_BARRIER someplace central like in bufdone() rather than in these specific error paths?
If we don't clear this flag in bufdone() then it would be good to assert in bufdone() that the flag is not set, to catch such mistakes earlier.
Sep 5 2020
Sep 1 2020
Jul 27 2020
ahh, right. the test I added for this fails the I/O in such a way (using gnop) that the iodone is actually called in the start path, so it's the same thread that xbusied the pages in that case. you said this problem was reported by other automated testing, how does that test fail I/O such that the iodone is called in a separate thread?
Jul 23 2020
Curious... is there a reason why this was added in addition to lib/libc/tests/sys/sendfile_test.c?
Jul 20 2020
Jul 17 2020
update diff for kib's latest comments.
Jul 15 2020
rename the new function and limit this diff to only fixing vnode_pager_generic_getpages_done().
Jul 14 2020
The proposal means that it is impossible to wire the page in non-sleepable context, unless we own xbusy on the page in advance. I believe this is no-go.
It is unusual for code to wire managed pages without using the busy lock to provide some consistency. vm_page_grab(), etc., provide mechanisms to avoid blocking, so callers can block and retry at a point of their choosing. In fact I cannot see any places in the tree today where a managed wiring is created without the busy lock.
I would agree that wiring could obey to this rule, but I believe we must provide sleep-less mechanism to prevent page from reuse. Some time ago it was hold, since then hold count was merged with wire count, thus wire count should provide such functionality.
Let's keep it for now then. In the meantime, we might generalize vm_page_readahead_free() to handle non-readahead pages. For example, fault_page_free() could also remove the page from its object. This function could also be used in tmpfs_reg_resize() and shm_dotruncate_locked().
Jul 8 2020
update diff with markj's suggestions.
Jul 6 2020
updated diff for markj's latest comments.
And yea, this patch does leave these invalid pages in an odd state, where the pagedaemon can't reclaim them (though if the vnode is reclaimed then all of these invalid pages will be freed at that point). I wasn't going to worry about that right now since the sendfile code already can leave pages in this state after an I/O error, and kib thought that was ok in a review of a previous fix for sendfile I/O error handling. But if you'd like this fix to avoid creating this situation in vnode_pager_generic_getpages_done(), we can do that too.
While I was looking into vm_page_readahead_finish(), I noticed that swp_pager_async_iodone() also leaves pages in this state.
I see. That looks like a bug to me.
Jun 26 2020
redo diff as markj suggested.
Yea, I didn't know what the problem having invalid pages on the paging queues would be either.
Jun 24 2020
The intention is that ffs_subr.c should only contain functions that are shared by the ufs kernel module and the libufs userland library. At some point the geom_label kernel module started using ffs_subr.c too even though that is cross-module direct reference, which is problematic when not all of the modules are statically included in the base kernel. Now that I moved the functions which are only needed by the ufs kernel module elsewhere, geom_label's instance of ffs_subr.c no longer references M_UFSMNT, so this change is not necessary.
Jun 18 2020
Jun 16 2020
Gleb asked me to commit this so that git blame will still blame me. :-)
The diff looks fine to me, adding kirk as a reviewer also.
Jun 6 2020
Jun 4 2020
May 25 2020
May 13 2020
really remove putpages wrapper this time.
update to address review comments.
May 12 2020
May 8 2020
update diff to 360823
May 2 2020
May 1 2020
Are there any more comments on this diff?
Apr 19 2020
generally, having the function that submits an async request return a pointer a request structure that is freed when the request completes is a bad idea, since the caller will have handle the request structure having already been freed, and thus having a pointer to it isn't useful. as you guys discussed, using the normal timeout path for polled commands (and fixing the normal timeout path to not be racy) would be good. a fun corner case will be when the use of the abort command in the timeout path itself times out.
Apr 3 2020
Mar 30 2020
Mar 18 2020
Mar 16 2020
Mar 9 2020
Mar 6 2020
Mar 5 2020
update with changes suggested by kib and imp.
Mar 4 2020
Feb 26 2020
There's no central place in the ufs code to add an assertion about not creating buffers on odevvp. What I could do is define a new BO_NOBUFS flag for bufobj bo_flag, set that flag on odevvp in ffs_mountfs() and clear the flag in ffs_unmount(), and then in buf_vlist_add() assert that (bo->bo_flag & BO_NOBUFS) == 0. Is that what you had in mind?
Feb 21 2020
Feb 18 2020
Feb 3 2020
Jan 16 2020
minor nit: the returned "resid" value is unused. otherwise looks good.
Nov 28 2019
Nov 25 2019
Nov 12 2019
Oct 16 2019
Oct 10 2019
Sep 13 2019
Sep 10 2019
Jul 2 2019
Jun 27 2019
Jun 21 2019
Jul 27 2018
I'll try to address all the points that everyone has made so far here.