Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

enter image description here

I came across this picture when learning samba. I am confused with the VFS module in this image.

  1. Why we need this VFS module in samba server instead of passing directly the intend system call to the C library? I understand in the client side we need a cifs.ko or smbfs for the kernel to understand the mounted file system.

    For example, when the client wants to read a file. It passes the corresponding protocol command to the server over network. And the server's Ethernet card will receive it and transmit to application layer. Then the CIFS protocol in the application layer will interpret this command and passes it to the c library which will eventually lead to the sys_read() system call. And in this procedure the VFS seems unnecessary.

  2. Is this module obligatroy? If not, how can I check if it is compiled?

Thanks

Supplement:

The picture aims to describe the smbd process architecture. It want to express that smbd has a multi-process and single thread architecture. I saw this in an article that compare the Samba 3.0 and another CIFS server called Likewise.

share|improve this question

migrated from stackoverflow.com Oct 10 '11 at 10:52

This question came from our site for professional and enthusiast programmers.

    
Can you tell us where the picture comes from and what it was supposed to convey? – larsmans Oct 7 '11 at 15:56
    
Hi @larsmans, sorry for not make that clear. I've already modify that, please see the supplement parts. Thanks – sliter Oct 7 '11 at 18:33

4 hours without any answer, so I'll add my guess: This might be a layer that translates physical paths (like /var/samba/share1/dir/file) into logical (share1\dir\file), together with necessary file name conversions, permission checks and so on. As such it is necessary and not optional.

Protocol implementation by itself might be something which already operates on the logical paths and simply puts whatever it can find in the VFS onto a wire.

share|improve this answer

It is not entirely clear what the diagram is meant to show. But all file system calls in Linux are handled by the VFS. In that sense the VFS is the bit of the kernel that services the system calls. But like you I am not sure why the diagram says VFS makes a blocking syscall.

But your explanation is also incorrect. If by client you mean something at the application layer then Samba should be transparent. It just thinks it is accessing another filesystem and will use the standard syscalls to do that (ie through VFS). The kernel would then route these calls through the network.

share|improve this answer

I think VFS modules extend the functionality of a posix file system.

https://www.samba.org/samba/docs/man/Samba-Developers-Guide/vfs.html

For example support for extended attributes for a particular file system is optional. However you can selective enable/ disable it.

share|improve this answer

Like Vink said, the VFS modules add functionality. Here are some examples. You can add a

  • virus scanner module which scans each file as it is being written,

  • recycling bin module which moves all deleted files to a recycling bin instead of deleting them

  • Auditing module which logs all access to the files so who touched what can be determined.

  • ceph filesystem module which directly connects the share to the ceph distributed file system without having to locally mount the ceph structure on that machine.

  • etc...

Additionally these modules can be stacked, thus combining their functionalities.

share|improve this answer

The VFS module a layer of abstraction that provides a consistent interface to different file system implementations.

Virtual file system

A virtual file system (VFS) or virtual filesystem switch is an abstraction layer on top of a more concrete file system. The purpose of a VFS is to allow client applications to access different types of concrete file systems in a uniform way. A VFS can, for example, be used to access local and network storage devices transparently without the client application noticing the difference. ...

SAMBA and all user-space processes need the VFS module in order to get to the actual file systems.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.