Sven Utcke | 4 Apr 10:19 2011
Picon
Picon

Re: error while trying to create mkdir through FUSE

Hello Vasanth,

> I am trying to incorporate the mkdir functionality. Now, I need some
> help on how I can go about doing this.

other than calling

return -(mkdir(path, mode)); // ??

> For starters,after I mount my file system ,How will I pass the name
> of the folder I intend to create?

Well, you call

./my_fs /where/to/mount

which mirrors some other directory ('/' by default).  Then, in order
to create a directory, you call something like

mkdir /where/to/mount/tmp/xyz

which will hopefully create the directory /tmp/xyz in the underlying
filesystem (assuming /tmp exists and is writeable).

> also I notice that , the mkdir function is not invoked.  This is
> after I have included the mkdir function alias in my fuse_operations
> oper block.

So what functions are invoked?

(Continue reading)

Ravi Krishnan | 8 Apr 08:06 2011
Picon

Re: error while trying to create mkdir through FUSE

Hi Sven, all,

I am working along side vasanth in creating a file system. All we are trying
to do is to do a simple mkdir function. We have represented our metadata
table as a simple structure with its members representing the column for the
table. Right now, I have dumped in certain directory entry to the table
using a for loop just to check the the getattr and readdir function.

The problem I am facing is when I do mkdir filename, it goes and checks in
getattr and returns an error saying "FILE DOES NOT EXIST" and if I give
mkdir ravi(which is already a directory) it gives me the error "FILE ALREADY
EXISTS". I understand that this happens to me from the getattr function. And
when I do -d option and trace the code, I can see that only getattr and
readdir are called FUSE does not call mkdir call since it hungs up with
error after getattr.

What should I do to resolve the problem. Any suggestion would be of immense
help.

This is the code I have written,

#define FUSE_USE_VERSION 26

#include<fuse.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<time.h>
#include<errno.h>
(Continue reading)

Sven Utcke | 14 Apr 12:38 2011
Picon
Picon

Re: error while trying to create mkdir through FUSE

Hello Ravi,

> The problem I am facing is when I do mkdir filename, it goes and
> checks in getattr and returns an error saying "FILE DOES NOT EXIST"
> and if I give mkdir ravi(which is already a directory) it gives me
> the error "FILE ALREADY EXISTS".

Even worse, on running your code I now see:

acer>/tmp% ls -li /tmp/mnt/
total 0
5 drwxr-xr-x 2 utcke utcke 0 2011-04-14 12:04 ravi
5 drwxr-xr-x 2 utcke utcke 0 2011-04-14 12:04 ravi
5 drwxr-xr-x 2 utcke utcke 0 2011-04-14 12:04 ravi

That's not good.  I wouln't expect to see "total 0", and I certainly
wouldn't expect to see three files with the same name  and  inode...

(ok, the inode is actually created by FUSE based on the name, but
still, you do get my point).

Then I do see:

acer>/tmp% mkdir mnt/xxx
mkdir: cannot create directory `mnt/xxx': File exists

also this clearly isn't the case, and 

acer>/tmp% mkdir mnt/ravi/xxx
mkdir: cannot create directory `mnt/ravi/xxx': File exists
(Continue reading)

Arun Theeban | 30 Aug 20:52 2012
Picon

Re: error while trying to create mkdir through FUSE

getattr() API should return -ENOENT, so subsequently mkdir() will be called.
Error number returning from getattr() is crucial here. 
Regards,
Arun

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Yongqiang Yang | 5 Sep 10:02 2012
Picon

Re: error while trying to create mkdir through FUSE

Hi Arun,

Could you explain more explicitly or paste some code to illustrate the problem?

Yongqiang.

On Fri, Aug 31, 2012 at 2:52 AM, Arun Theeban
<arun.theeban.hnk@...> wrote:
> getattr() API should return -ENOENT, so subsequently mkdir() will be called.
> Error number returning from getattr() is crucial here.
> Regards,
> Arun
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> fuse-devel mailing list
> fuse-devel@...
> https://lists.sourceforge.net/lists/listinfo/fuse-devel

--

-- 
Best Wishes
Yongqiang Yang

------------------------------------------------------------------------------
(Continue reading)

Picon

Re: error while trying to create mkdir through FUSE

Hi,
    A single command might correspond to multiple fuse operations on
the file system side. So it's important to know what operations would
be triggered on file system side. For example, "mkdir" command
actually corresponds to  fs_getattr()  and fs_mkdir(). Here I'm
assuming fs_getattr() and fs_mkdir() are fuse operations which you
have defined for your file system.

fs_getattr() would inform FUSE library whether directory already
exists. If it exists, then FUSE would never call fs_mkdir(), if not
exists, then FUSE library will call fs_getattr(). So for mkdir command
to work, firstly you have to define fs_getattr(), which would return
proper error code in negative.

Say, if you do "mkdir foo",  then fs_getattr() MUST return -ENOENT if
the directory foo doesn't exists. Once FUSE library sees -ENOENT, then
subsequently fs_mkdir() would be called. But if you return some other
error code, FUSE library will never call fs_mkdir(). So it's crucial
to return proper error code.

Hope this helps.

Regards,
Arun

On Wed, Sep 5, 2012 at 1:32 PM, Yongqiang Yang <xiaoqiangnk@...> wrote:
> Hi Arun,
>
> Could you explain more explicitly or paste some code to illustrate the problem?
>
(Continue reading)


Gmane