mirror of https://github.com/schoebel/mars
infra: fix replacement of .deleted links with files
This commit is contained in:
parent
c0c468a3f7
commit
f770728c72
|
@ -33,6 +33,9 @@
|
|||
#include <linux/wait.h>
|
||||
#include <linux/file.h>
|
||||
|
||||
/* needed for symlink checking */
|
||||
#include "sy_old/strategy.h"
|
||||
|
||||
// time to wait between background mapfree operations
|
||||
int mapfree_period_sec = 10;
|
||||
EXPORT_SYMBOL_GPL(mapfree_period_sec);
|
||||
|
@ -185,6 +188,16 @@ struct mapfree_info *mapfree_get(const char *name, int flags)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* allow replacement of a .deleted symlink */
|
||||
if (flags & O_CREAT) {
|
||||
const char *check = ordered_readlink(name, NULL);
|
||||
|
||||
if (check && !*check)
|
||||
mars_unlink(name);
|
||||
|
||||
brick_string_free(check);
|
||||
}
|
||||
|
||||
mf->mf_flags = flags;
|
||||
INIT_LIST_HEAD(&mf->mf_head);
|
||||
INIT_LIST_HEAD(&mf->mf_dirty_anchor);
|
||||
|
|
Loading…
Reference in New Issue