On Thu, Jan 4, 2018 at 5:40 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > A previous failed attempt to create or whiteout a directory index may leave > index entries named '#%x' in the index dir. > Cleanup those temp entries on mount instead of failing the mount. > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > --- > fs/overlayfs/namei.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c > index e53c54ecb7cc..4987d7df1581 100644 > --- a/fs/overlayfs/namei.c > +++ b/fs/overlayfs/namei.c > @@ -9,6 +9,7 @@ > > #include <linux/fs.h> > #include <linux/cred.h> > +#include <linux/ctype.h> > #include <linux/namei.h> > #include <linux/xattr.h> > #include <linux/ratelimit.h> > @@ -452,6 +453,24 @@ static struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index) > return upper.dentry; > } > > +/* Is this a leftover from create/whiteout of directory index entry? */ > +static bool ovl_is_temp_index(struct dentry *index) > +{ > + const char *p = index->d_name.name; > + int len = index->d_name.len; > + > + if (!d_is_dir(index) && !ovl_is_whiteout(index)) > + return false; > + > + if (*p++ != '#' || len < 2) > + return false; I don't see a point in extensive verification that it's a well formed temp file name. Just checking that the first character is "#" should be enough, no? Thanks, Miklos -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html