diff --git a/kernel/lib_mapfree.c b/kernel/lib_mapfree.c index 9111e192..69c0574b 100644 --- a/kernel/lib_mapfree.c +++ b/kernel/lib_mapfree.c @@ -33,6 +33,9 @@ #include #include +/* 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);