Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/listing #9

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions Design.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,33 +192,23 @@ __. and ..__
File creation is decoupled from open and write. A new entry is created in DBD. the metadata associated to the object notably contains:
- a random content-md5 with char #32 set to '-'
- Date and last-modified set to now()
- owner-display-name and owner-id set to configured values
- owner-display-name and owner-id set to the values found in the bucket attributes
- an empty locations array
- Future: Do we have to remove the placeholder??
- Future: Do we have to remove or update the placeholder?

This has the effect of creating instantly an empty file.


## File removal

- Future: If the object is the last with this prefix, create a placeholder
- delete object entry from DBD bucket
- delete all parts from sproxyd storage

At this time, it's kind of broken when the file to remove is the last in the prefix.

### Directory creation

- Future: Create a placeholder for the directory

At this time, directory creation is badly implemented using internal states that can't be relied on.
Directories are created as placeholders. A placeholder is an empty object named after the directory name with a trailing slash (```/```) with content-type set to ```application/x-directory```


### Directory removal
## File/Directory removal

- Future: delete the placeholder if it is the last object with this prefix

Today, it's almost broken
- create the placeholder and replace it if it already exists ! it is faster than a lookup
- if it is a directory removal, check if it is empty
- delete object entry from DBD bucket
- if it is a file delete all parts from sproxyd storage

### Open a file

Expand Down Expand Up @@ -255,20 +245,22 @@ When a commit is requested by the client, the object entry in DBD is updated wit

On regular files (which are backed by real objects) getattrs requests the object's metadata from DBD.
- Atime, mtime, ctime and chgtime are set to last-modified
- uid/gid are left blank
- uid/gid are set to configured values
- size is set to "content-length"
- parts list is updated


On directories, it's another story. A prefix/delimiter request is performed to check if the directory still exist. If it is the case, in memory structure is left unchanged.
On directories, it's another story.
- Without a placeholder, a prefix/delimiter request is performed to check if the directory still exist. If it is the case, in memory structure is left unchanged.
- With a placeholder, placeholder content is loaded like regular files

Regarding directories, there is something worth to mention. Directory content invalidation takes place here, in order to the client to get a fresh directory content. This invalidation is done using ganesha upcalls.



### setattrs

Setattrs only applies on regular files.
Setattrs only applies on regular files and directories, even without a placeholder.

The following information is kept up to date by Scality NFS
- FIXME: last-modified and Date are set to now()
Expand Down
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,26 @@ $ docker build -t scality/nfsd .

A configuration file must be provided, check the dbd and sproxyd urls and set the MYBUCKET shell var with the bucket name you want to be exported.

OWNER_DISPLAY_NAME and OWNER_ID must be set in order to be able to read back from S3 data written through NFS. This information should be retrieved using a curl command on an existing object in the bucket
```
$ curl http://127.0.0.1:9004/default/bucket/$MYBUCKET/existing_object
```
User/group mapping is done using ```Anonymous_uid```/```Anonymous_gid``` parameters. By default these values are set to 0:0 (which is traditionally root:root). Existing and new files will be automatically owned by the user/group pointed by these values.

Regarding the POSIX rights, by default directories have ```06777``` permission and regular files have ```0666```. The umask parameter is used to unset permission bits of files and directories (e.g. a bit set in the umask will unset the corresponding bit in the permission bitmap). Default umask is 0

Most systems support set-group-ID on directories (and few systems also support set-user-ID). So these bits are set by default in order to be consistent regarding the newly created files belonging to the defined uid and gid.

In the following configuration, objects belong to nobody:users with a umask of 02. This gives ```06775``` on directories and ```0664``` on files. This permits to all users belonging to the ```users``` group to access R/W the export. But worth to mention, it is not possible to alter the attributes of a file for which the owner doesn't match the uid of the running process. commands such as cp(1), chmod(1), chown(1), touch(1) may return EPERM

(Note: ganesha fails to parse umask starting with multiple 0)

```
$ mkdir conf logs
$ MYBUCKET=mybucket
$ OWNER_DISPLAY_NAME=ABC
$ OWNER_ID=XYZ
$ ANON_USER=nobody
$ ANON_GROUP=users
$ ANON_UMASK=02
$ cat >conf/scality-nfsd.conf <<EOF
SCALITY
{
dbd_url = "http://127.0.0.1:9004/default/bucket";
dbd_url = "http://127.0.0.1:9000";
sproxyd_url = "http://127.0.0.1:8181/proxy/arc";
}

Expand All @@ -70,12 +75,14 @@ EXPORT
# Could use CLIENT blocks instead
Access_Type = RW;

Anonymous_uid = $(id -u $ANON_USER);
Anonymous_gid = $(awk -F: '/^'$ANON_GROUP':/ { print $3 }' /etc/group);

# Exporting FSAL
FSAL {
Name = "SCALITY";
bucket = "$MYBUCKET";
owner_display_name = "$OWNER_DISPLAY_NAME";
owner_id = "$OWNER_ID";
umask = $ANON_UMASK;
}
}
EOF
Expand Down
Loading