[Devel,RFC,1/2] autofs: set compat flag on sbi when daemon uses 32bit addressation

Submitted by Stanislav Kinsburskiy on Aug. 31, 2017, 1:57 p.m.

Details

Message ID 20170831135706.14009.14577.stgit@localhost.localdomain
State New
Series "autofs: add "compat" support"
Headers show

Commit Message

Stanislav Kinsburskiy Aug. 31, 2017, 1:57 p.m.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 fs/autofs4/inode.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Patch hide | download patch | download mbox

diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index b23cf2a..989ac38 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -217,6 +217,7 @@  int autofs4_fill_super(struct super_block *s, void *data, int silent)
 	int pgrp;
 	bool pgrp_set = false;
 	int ret = -EINVAL;
+	struct task_struct *tsk;
 
 	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
 	if (!sbi)
@@ -281,10 +282,25 @@  int autofs4_fill_super(struct super_block *s, void *data, int silent)
 				pgrp);
 			goto fail_dput;
 		}
+		tsk = get_pid_task(sbi->oz_pgrp, PIDTYPE_PGID);
+		if (!tsk) {
+			pr_warn("autofs: could not find process group leader %d\n",
+				pgrp);
+			goto fail_put_pid;
+		}
 	} else {
 		sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID);
+		get_task_struct(current);
+		tsk = current;
 	}
 
+	if (test_tsk_thread_flag(tsk, TIF_ADDR32))
+		sbi->is32bit = 1;
+	else
+		sbi->is32bit = 0;
+
+	put_task_struct(tsk);
+
 	if (autofs_type_trigger(sbi->type))
 		__managed_dentry_set_managed(root);