VFS - ENOTSUP vs ENOSYS

Ira Cooper ira at wakeful.net
Tue Sep 1 13:03:40 UTC 2015


Michael Adam <obnox at samba.org> writes:

> On 2015-08-31 at 20:33 -0400, Ira Cooper wrote:
>> Hello,
>> 
>> I've hit a bug that I'm working on fixing involving kernel share modes,
>> and vfs modules that don't implement them.
>> 
>> But I realized, returning ENOSYS was wrong, because in this case
>> kernel_flock will implement it on XFS.  But Gluster doesn't support
>> kernel_flock.  So it should return ENOTSUP not ENOSYS, IMHO.
>
> Maybe I am just confused, but looking at the code in open.c,
> where SMB_VFS_KERNEL_FLOCK is called, we currently have a problem
> of getting sharing violation for any vfs module that returns
> -1 from kernel_flock_fn, irrespective of the errno?
> (The code does not check it.)

Correct, that's the problem that opened "pandora's box".

> I have had the impression before, that I can't see
> how the current glusterfs vfs module can work without
> 'kernel share modes = no' in the config.
>
> Maybe I am also just missing a subtle point.

The real queston is, are we returning the correct errno.  I'm not clear
on that topic.

ENOSYS - Implies things will never succeed on this system.
ENOTSUP - Implies that the feature you requested is not supported in
          this situation.

I'll admit the difference seems subtle, but the thing is if you get
ENOSYS, you can shortcut that check forever.  You know the check should
never work.  ENOTSUP implies there may be another fd or whatever where
it could work.

Given that we support multiple VFS modules, it is hard for me to see
many cases where we'd return ENOSYS in reality.

Now, I do consider this an ABI change, and one which may break modules
not in tree.  (Will?)

I'd really like feedback on this before I start looking at how to fix
it.  ENOTSUP is a proposed errno for this situation.  If people have
other ideas, I'm all ears.

Thanks,

-Ira



More information about the samba-technical mailing list