[LTP] [PATCH v1] Test statx() with flag AT_NO_AUTOMOUNT.

vishnu vishnu@zilogic.com
Fri Oct 5 14:35:59 CEST 2018


Hi,

>> +	pid = SAFE_FORK();
>> +	if (!pid) {
>> +		setpgrp();
>
> Why do you do this?

* Parent is getting the autofs notification message only by setting
  the process group ID of the child process to it's process ID.


>
>> +		TEST(statx(AT_FDCWD, MNTPOINT,
>> +			   (automount) ? 0 : AT_NO_AUTOMOUNT,
>> +			   0, &file_info)
>> +		     );
>> +
>> +		if (TST_RET == -1) {
>> +			/* 1 -> statx() fail*/
>> +			value = 1;
>> +			SAFE_WRITE(1, ev_fd, &value, sizeof(value));
>> +
>> +			exit(1);
>> +		}
>> +
>> +		/* 2 -> statx() pass*/
>> +		value = 2;
>> +		SAFE_WRITE(1, ev_fd, &value, sizeof(value));
>
> There is no need to propagate anything from the child process, if you
> call tst_res(TPASS, ...) in the child process the result will be
> propagated automatically to the parent. So there is no need for the
> eventfd at all.

* Parent won't get any autofs request from child if,
  ** statx fails
  ** statx with AT_NO_AUTOMOUNT flag

  We tried using event_fd() in order to identify between these two
  scenarios and read from pipe only if statx passed.
  Breaking the test from the child if statx fails is not affecting the
  parent.

Thanks and Regards,
Vishnu K






More information about the ltp mailing list