Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226697
b: refs/heads/master
c: 2bc334d
h: refs/heads/master
i:
  226695: 9481e36
v: v3
  • Loading branch information
Nick Piggin committed Jan 7, 2011
1 parent 1fbefc7 commit d00e341
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 79eb4dde742fe2e9c9e301432b894a7410261ce7
refs/heads/master: 2bc334dcc7c77be3700dd443d92a78603f76976b
43 changes: 35 additions & 8 deletions trunk/fs/jfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <linux/fs.h>
#include <linux/namei.h>
#include <linux/ctype.h>
#include <linux/quotaops.h>
#include <linux/exportfs.h>
Expand Down Expand Up @@ -1597,21 +1598,47 @@ static int jfs_ci_compare(struct dentry *dir, struct qstr *a, struct qstr *b)
goto out;
}
result = 0;
out:
return result;
}

static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd)
{
/*
* We want creates to preserve case. A negative dentry, a, that
* has a different case than b may cause a new entry to be created
* with the wrong case. Since we can't tell if a comes from a negative
* dentry, we blindly replace it with b. This should be harmless if
* a is not a negative dentry.
* This is not negative dentry. Always valid.
*
* Note, rename() to existing directory entry will have ->d_inode,
* and will use existing name which isn't specified name by user.
*
* We may be able to drop this positive dentry here. But dropping
* positive dentry isn't good idea. So it's unsupported like
* rename("filename", "FILENAME") for now.
*/
memcpy((unsigned char *)a->name, b->name, a->len);
out:
return result;
if (dentry->d_inode)
return 1;

/*
* This may be nfsd (or something), anyway, we can't see the
* intent of this. So, since this can be for creation, drop it.
*/
if (!nd)
return 0;

/*
* Drop the negative dentry, in order to make sure to use the
* case sensitive name which is specified by user if this is
* for creation.
*/
if (!(nd->flags & (LOOKUP_CONTINUE | LOOKUP_PARENT))) {
if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
return 0;
}
return 1;
}

const struct dentry_operations jfs_ci_dentry_operations =
{
.d_hash = jfs_ci_hash,
.d_compare = jfs_ci_compare,
.d_revalidate = jfs_ci_revalidate,
};

0 comments on commit d00e341

Please sign in to comment.