Page MenuHomeFreeBSD

don't send the message if there was an issue in constructing it. Also allocate the fixed buffer with M_NOWAIT. It was overlooked in the various code movements during review.
AbandonedPublic

Authored by imp on Aug 19 2020, 5:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 2:51 AM
Unknown Object (File)
Dec 20 2023, 2:58 AM
Unknown Object (File)
Jun 10 2023, 5:24 AM
Unknown Object (File)
Apr 26 2023, 3:56 AM
Unknown Object (File)
Apr 8 2023, 10:22 AM
Unknown Object (File)
Jan 7 2023, 6:09 PM
Subscribers

Details

Reviewers
kib
Summary

Noticed by: Shawn Webb

I think that kib@ wanted something more like this when things were locked. They are no longer locked, but I think this is the right thing to do...

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33070
Build 30447: arc lint + arc unit

Event Timeline

imp requested review of this revision.Aug 19 2020, 5:50 PM
imp created this revision.
imp added a reviewer: kib.

This makes the mechanism even less useful.

I made an (ignored) note in the previous review that unmount options can be changed by unmount, so they are not that interesting.

Options for mounted filesystem can be obtained from the fs itself using statfs(2) or like. It is more important for consumer to be notified that a mount was created or destroyed, than to provide a lot of secondary data. I would suggest to send some simpler message if large buffer cannot be allocated, e.g. fall back to small alloca().

In D26122#579967, @kib wrote:

This makes the mechanism even less useful.

Yea, good point...

I made an (ignored) note in the previous review that unmount options can be changed by unmount, so they are not that interesting.

Yea, I included it to communicate forced vs non forced. Perhaps we should do that in other ways? Now I understand it better, I'm back with you...

Options for mounted filesystem can be obtained from the fs itself using statfs(2) or like. It is more important for consumer to be notified that a mount was created or destroyed, than to provide a lot of secondary data. I would suggest to send some simpler message if large buffer cannot be allocated, e.g. fall back to small alloca().

That's an interesting approach... I'll noodle through that and post a new version.... ah, the only question I have is how big is too big? If we can do 1k on the stack, maybe we should just do that all the time... if not, what's a good limit?

In D26122#579979, @imp wrote:

That's an interesting approach... I'll noodle through that and post a new version.... ah, the only question I have is how big is too big? If we can do 1k on the stack, maybe we should just do that all the time... if not, what's a good limit?

We can probe remaining stack with GET_STACK_USAGE()... I don't know if/how much we need to leave for interrupts, and we need to leave a few bytes for whatever devctl_notify() does, but that at least gives us a heuristic for "is a large stack buffer reasonable?"

In D26122#579979, @imp wrote:
In D26122#579967, @kib wrote:

This makes the mechanism even less useful.

Yea, good point...

I made an (ignored) note in the previous review that unmount options can be changed by unmount, so they are not that interesting.

Yea, I included it to communicate forced vs non forced. Perhaps we should do that in other ways? Now I understand it better, I'm back with you...

But forced unmount is passed as MNTK_UNMOUNTF, it is in mnt_kern_flags. MNT_FORCE is for forced rw mounts of dirty fs, and for forced remounts rw->ro. Yes, it very confusing.

Options for mounted filesystem can be obtained from the fs itself using statfs(2) or like. It is more important for consumer to be notified that a mount was created or destroyed, than to provide a lot of secondary data. I would suggest to send some simpler message if large buffer cannot be allocated, e.g. fall back to small alloca().

That's an interesting approach... I'll noodle through that and post a new version.... ah, the only question I have is how big is too big? If we can do 1k on the stack, maybe we should just do that all the time... if not, what's a good limit?

Assume that you have 256 bytes, this is sane value for all arches and in fact should be enough to pass fsid. 1k is not reasonable IMO.

In D26122#580009, @cem wrote:
In D26122#579979, @imp wrote:

That's an interesting approach... I'll noodle through that and post a new version.... ah, the only question I have is how big is too big? If we can do 1k on the stack, maybe we should just do that all the time... if not, what's a good limit?

We can probe remaining stack with GET_STACK_USAGE()... I don't know if/how much we need to leave for interrupts, and we need to leave a few bytes for whatever devctl_notify() does, but that at least gives us a heuristic for "is a large stack buffer reasonable?"

The real answer is to pre-allocate. I have a better patch that does that in the works I'll post in a bit.