diff options
| author | Daniel Rosenberg <drosen@google.com> | 2016-08-21 21:04:12 -0700 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-11 10:59:52 +0200 |
| commit | 73410a26f7c5d013055cddbd271520fb351afacd (patch) | |
| tree | 7f4cab117c333944e45b7c17340d30600d820596 | |
| parent | bcba1c627f32a0c11d2c2c393d0ed5c9bb671c5a (diff) | |
| download | android_kernel_m2note-73410a26f7c5d013055cddbd271520fb351afacd.tar.gz | |
sdcardfs: Remove stale dentries when reusing an inode.
When an inode is moved in one view of sdcardfs, others
do not know about it until the information is requested,
and even then, the old dentry is not invalidated until
it is used. If the inode moves back, it may successfully
revalidate with stale permissions. Since we do not allow
hard links, we can avoid this by removing alias's when
we reuse an inode.
Change-Id: I3c00c496b436af4d3309a77a596dec8fd5906cdd
Signed-off-by: Daniel Rosenberg <drosen@google.com>
| -rwxr-xr-x | fs/sdcardfs/lookup.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/sdcardfs/lookup.c b/fs/sdcardfs/lookup.c index a01b06a51..cb3887e3a 100755 --- a/fs/sdcardfs/lookup.c +++ b/fs/sdcardfs/lookup.c @@ -111,8 +111,13 @@ struct inode *sdcardfs_iget(struct super_block *sb, struct inode *lower_inode, u return ERR_PTR(err); } /* if found a cached inode, then just return it */ - if (!(inode->i_state & I_NEW)) + if (!(inode->i_state & I_NEW)) { + /* There can only be one alias, as we don't permit hard links + * This ensures we do not keep stale dentries that would later + * cause confusion. */ + d_prune_aliases(inode); return inode; + } /* initialize new inode */ info = SDCARDFS_I(inode); |
