Skip to contentSkip to conversation

tmpfs-restore-functionality-of-nr_inodes=0.patch removed from -mm tree

merged [email protected] 1 participant 1 message Sep 26, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: tmpfs: restore functionality of nr_inodes=0
has been removed from the -mm tree. Its filename was
tmpfs-restore-functionality-of-nr_inodes=0.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Byron Stanoszek <[email protected]>
Subject: tmpfs: restore functionality of nr_inodes=0

Commit e809d5f0b5c9 ("tmpfs: per-superblock i_ino support") made changes to shmem_reserve_inode() in mm/shmem.c, however the original test for (sbinfo->max_inodes) got dropped. This causes mounting tmpfs with option nr_inodes=0 to fail:

  # mount -ttmpfs -onr_inodes=0 none /ext0
  mount: /ext0: mount(2) system call failed: Cannot allocate memory.

This patch restores the nr_inodes=0 functionality.

---

 mm/shmem.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
mm/shmem.c renamed from mm/shmem.c~tmpfs-restore-functionality-of-nr_inodes=0 +6 -4
@@ -279,11 +279,13 @@ static int shmem_reserve_inode(struct su
 
 	if (!(sb->s_flags & SB_KERNMOUNT)) {
 		spin_lock(&sbinfo->stat_lock);
-		if (!sbinfo->free_inodes) {
-			spin_unlock(&sbinfo->stat_lock);
-			return -ENOSPC;
+		if (sbinfo->max_inodes) {
+			if (!sbinfo->free_inodes) {
+				spin_unlock(&sbinfo->stat_lock);
+				return -ENOSPC;
+			}
+			sbinfo->free_inodes--;
 		}
-		sbinfo->free_inodes--;
 		if (inop) {
 			ino = sbinfo->next_ino++;
 			if (unlikely(is_zero_ino(ino)))

_

Patches currently in -mm which might be from [email protected] are