Skip to content

open-behind should be disabled by default #3785

@xhernandez

Description

@xhernandez

Description of problem:

When open-behind is enabled, bricks don't really see the open request until another request that requires the fd is sent by the user. At that time, open-behind first opens the file and then executes the related request.

This is bad when the file is deleted before the actual open.

For example, an application doing an open() followed by an fstat() will see an ENOENT or ESTALE error in fstat() if someone else has deleted the file between open() and fstat(), but this should never happen from the application point of view because a successful open should guarantee that the file is not gone.

When bricks receive a delete operation, they check if there are open file descriptors. If so, the file is removed from the directory but not physically deleted from the brick, so that other operations depending on the fd can work as expected. However, since open-behind "hides" the open file descriptor from the bricks, they think the file is not used anymore and delete it upon receiving the unlink request.

Additionally, the useful use cases for open-behind are very limited, so I would say we should have it disabled by default and only enable it if explicitly requested by the user.

Another possibility is to completely remove the open-behind xlator. It doesn't provide much benefit in many real use cases, and completely breaks posix compliance.

The exact command to reproduce the issue:

  1. Create a volume
  2. Mount it in 2 mount points M1 and M2
  3. Create a file in M1
  4. Open the file from M1
  5. Delete the file from M2
  6. Wait 5 seconds (to avoid using cached data)
  7. fstat the file on M1

The last fstat will fail with ENOENT or ESTALE.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions