|
@@ -2901,10 +2901,14 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
|
|
|
* No ordinary (disk based) filesystem counts links as inodes;
|
|
* No ordinary (disk based) filesystem counts links as inodes;
|
|
|
* but each new link needs a new dentry, pinning lowmem, and
|
|
* but each new link needs a new dentry, pinning lowmem, and
|
|
|
* tmpfs dentries cannot be pruned until they are unlinked.
|
|
* tmpfs dentries cannot be pruned until they are unlinked.
|
|
|
|
|
+ * But if an O_TMPFILE file is linked into the tmpfs, the
|
|
|
|
|
+ * first link must skip that, to get the accounting right.
|
|
|
*/
|
|
*/
|
|
|
- ret = shmem_reserve_inode(inode->i_sb);
|
|
|
|
|
- if (ret)
|
|
|
|
|
- goto out;
|
|
|
|
|
|
|
+ if (inode->i_nlink) {
|
|
|
|
|
+ ret = shmem_reserve_inode(inode->i_sb);
|
|
|
|
|
+ if (ret)
|
|
|
|
|
+ goto out;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
dir->i_size += BOGO_DIRENT_SIZE;
|
|
dir->i_size += BOGO_DIRENT_SIZE;
|
|
|
inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
|
|
inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
|