Apropos my earlier question (see 3 below) on locking inside Ganesha, I did
a survey of the locks used
in various operations.   Is the following list accurate ?

Operation : Lock taken (Mode)
----------------------------------------------

access : cache_entry.attr_lock (Write)
getattr : cache_entry.attr_lock (Write)
setattr : if size is being set, take content_lock (Write)

lookup : content_lock on cache_entry of parent directory (Read)
readdir : content lock on directory (Read)
create : after create on fsal, take content_lock on parent directory (Write)
unlink : after unlink on fsal, take content_lock on parent directory (Write)
rename : after rename on fsal, take content lock on both parent directory
(Write)

open : content_lock (Write)
close : content_lock (Write)
read :  content_lock (Read)
write : content_lock (Read)
status : content_lock (Read)
commit : content_lock (Read)

-Sandeep

>On 12/09/2016 06:52 AM, Sandeep Joshi wrote:
>>
>> I am building an FSAL wrt 2.4-stable and had a few questions
>>
>>
https://github.com/nfs-ganesha/nfs-ganesha/blob/V2.4-stable/src/include/fsal_api.h
>>
>> 1) When is fsal_set_credentials() to be called ?
>>
>> I noticed FSALs call it at varying places.
>>
>> VFS does it in  get_quota, set_quota, open2, write2, commit2, mkdir,
>> mknod, symlink, rename, unlink
>>
>> CEPH - write2
>>
>> GPFS does it in get_quota, set_quota, create, create2, commit2, open,
>> read, write, mkdir, mknod, link, rename, symlink, unlink
>
>It should be called whenever an operation needs to be done as the client
>user, rather than as root (which is what Ganesha runs as).  When this is
>depends on the FSAL, and it's user/permission model.  VFS should have
>the complete set, so some or all of those operations.
>
>>
>> 2) There is a mdcache FSAL layered above the FSAL in 2.4.  Is the cache
>> then per-export or per-fsal ?
>
>This depends.  The handle cache is global, keyed on the per-FSAL key for
>the object.  The dirent cache is per directory.
>
>> 3) What are the situations under which an FSAL would need to mandatorily
>> take  fsal_obj_handle.lock ?
>>
>>
https://github.com/nfs-ganesha/nfs-ganesha/blob/V2.4-stable/src/include/fsal_api.h#L3002
>>
>> In some cases, the upper layer has already taken the lock (e.g open,
>> close).  There is very little documentation on this aspect.
>
>This is, indeed, not well documented.  Shares (and share counters) are
>generally protected. FDs are usually protected. PSEUDO protects it's
>dirent tree.
>
>In general, you need to protect all accesses to shares, and probably to
>your FD, and feel free to use it to protect anything else in your
>obj_handle that you need to protect.
>
>Daniel


On Fri, Dec 9, 2016 at 5:22 PM, Sandeep Joshi <sanjos...@gmail.com> wrote:

>
> I am building an FSAL wrt 2.4-stable and had a few questions
>
> https://github.com/nfs-ganesha/nfs-ganesha/blob/V2.4-
> stable/src/include/fsal_api.h
>
> 1) When is fsal_set_credentials() to be called ?
>
> I noticed FSALs call it at varying places.
>
> VFS does it in  get_quota, set_quota, open2, write2, commit2, mkdir,
> mknod, symlink, rename, unlink
>
> CEPH - write2
>
> GPFS does it in get_quota, set_quota, create, create2, commit2, open,
> read, write, mkdir, mknod, link, rename, symlink, unlink
>
> 2) There is a mdcache FSAL layered above the FSAL in 2.4.  Is the cache
> then per-export or per-fsal ?
>
> 3) What are the situations under which an FSAL would need to mandatorily
> take  fsal_obj_handle.lock ?
>
> https://github.com/nfs-ganesha/nfs-ganesha/blob/V2.4-
> stable/src/include/fsal_api.h#L3002
>
> In some cases, the upper layer has already taken the lock (e.g open,
> close).  There is very little documentation on this aspect.
>
> -Sandeep
>
>
>
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Nfs-ganesha-devel mailing list
Nfs-ganesha-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel

Reply via email to