Re: Why is the length of max mount option a page size??

From: Jungsub Shin
Date: Mon May 28 2018 - 20:39:29 EST


On Fri, May 25, 2018 at 07:42:10PM +0900, J. R. Okajima wrote:
> Jungsub Shin:
> > I know that almost mount option short and page size is enough to
> > contain almost mount options. but because of options for
> > unionfs(overlay, aufs), lenght of mount option could be exceed it
> > and cut.
> >
> > I suffer this problem with aufs. aufs's branch option is cut and
> > fail to aufs mount. I know that aufs is not offical fs in linux,
>
> For aufs, it should not happen because of the module parameter 'brs.'
>
> (from the aufs manual)
> ----------------------------------------------------------------------
> .SH Module Parameters
> .TP
> .B brs=1 | 0
> Specifies to use the branch path data file under sysfs or not.
>
> If the number of your branches is large or their path is long
> and you meet the limitation of mount(8) ro /etc/mtab, you need to
> enable CONFIG_SYSFS and set aufs module parameter brs=1.
>
> When this parameter is set as 1, aufs does not show `br:' (or dirs=)
> mount option through /proc/mounts (and /etc/mtab). So you can
> keep yourself from the page limitation of
> mount(8) or /etc/mtab.
> Aufs shows branch paths through <sysfs>/fs/aufs/si_XXX/brNNN.
> Actually the file under sysfs has also a size limitation, but I don't
> think it is harmful.
>
> There is one more side effect in setting 1 to this parameter.
> If you rename your branch, the branch path written in /etc/mtab will be
> obsoleted and the future remount will meet some error due to the
> unmatched parameters (Remember that mount(8) may take the options from
> /etc/mtab and pass them to the systemcall).
> If you set 1, /etc/mtab will not hold the branch path and you will not
> meet such trouble. On the other hand, the entries for the
> branch path under sysfs are generated dynamically. So it must not be obsoleted.
> But I don't think users want to rename branches so often.
>
> If CONFIG_SYSFS is disable, this parameter is always set to 0.
> ----------------------------------------------------------------------
>
>
> If you post the details of your environment to aufs-users ML, then I
> may be able to describe more.
>
>
> J. R. Okajima

I think brs module option is irrelevant to this issue. brs module
option looks like that didn't affect passing option parameter with in
mount() system call.

I suffered this problem below environments.
------------------------------------------------------------------------
OS : Ubuntu 18.04 LTS / 4.15.0-20-generic / 64bit
AUFS module parameter : brs = 1 / allow_userns = N
Mount command : mount -t aufs -o br=~/tca_agent/container_rw_dir/51509032=rw:~/tca_agent/image_layer_dir/5a259d94211e449fd466d997b5b0b149cb2997a732fd3a838c14295e0eb93f92=ro+wh:~/tca_agent/image_layer_dir/faca908333f884648b75738571879df977339ee7615c65410c98001a463bcd00=ro+wh:~/tca_agent/image_layer_dir/67b50813aedeb67fd06b434163fa64d07fbd16f714196daea1cd139a0171b080=ro+wh:~/tca_agent/image_layer_dir/28b6f7699be037b7f80dd03b22830712aa75b88ddfbba0910dd059b522fbff20=ro+wh:~/tca_agent/image_layer_dir/c47c7125efa9172d262c5b3645594010704f67cf44005da9f6d7ea5a5d2a05db=ro+wh:~/tca_agent/image_layer_dir/b91ed1b448ac52d251c785f5cfc299ca3ba4cfd68d739832b766228afa84a651=ro+wh:~/tca_agent/image_layer_dir/0169cd8bc0bdbecedb30c7d995e69e832d7ccd5c435e72c40af6940db87851b7=ro+wh:~/tca_agent/image_layer_dir/e7ef7d443e31f8b3b8a0a002a6895746d3737289eb2eea18d669924c089279f2=ro+wh:~/tca_agent/image_layer_dir/31bfb0cd724fda09280305b8dc1c4b0587ca01f5dd503d28afa82cff4fa92475=ro+wh:~/tca_agent/image_layer_dir/74428f0d76521fa9b9b1189cb72d303e367003c113cc8a11db125e3f7df1daa1=ro+wh:~/tca_agent/image_layer_dir/b20a927da14045cac0cd6a745f67fdeb88ead6d85752c670ea2773b27387f6ae=ro+wh:~/tca_agent/image_layer_dir/7dee3bce119631e3c922d78860d6b0ae160e237b63bf19f43713a05d1086c72f=ro+wh:~/tca_agent/image_layer_dir/636bce8f18e8734cb98f170bdcf1fb9ae52f1b091bfadcb2bef378b0d829ceb6=ro+wh:~/tca_agent/image_layer_dir/9c6fde234e701cf7b61534ef3a23cc4e0cdb6d3ffc497feaa8fcddc52e8d1fda=ro+wh:~/tca_agent/image_layer_dir/83c2f1968a932e3e284ef20b10a4ef8a9cfc01589dacf2100fb9a78e88c3888e=ro+wh:~/tca_agent/image_layer_dir/ec096a351601040fcd37c31edccd2f68106438097e8adf7253539366b2232de5=ro+wh:~/tca_agent/image_layer_dir/6de889accecb819028355196bde150749598e982b5dfe556540e102c737bfc34=ro+wh:~/tca_agent/image_layer_dir/1042cb8f2263d1030fdb57e0ca671b34a2180bb35d9448737e4a03e4987cf942=ro+wh:~/tca_agent/image_layer_dir/4fab8c997a447af2375e325467661ca1d74bf62dc6d802426f20d0134c9c43bc=ro+wh:~/tca_agent/image_layer_dir/ca57efb1c28464fab46af1826243c02af0a0b6cfb90bf92b30110e79028c5e68=ro+wh:~/tca_agent/image_layer_dir/ad86d54176611b5117fc155e8dfbd0b59bc0abce4e2051baef12c2f1e152c92f=ro+wh:~/tca_agent/image_layer_dir/f323ae7b264dcc517876e7c722ac3369baaef1a7c18cc5aae5f43f440fd646c0=ro+wh:~/tca_agent/image_layer_dir/a7d1c89c8422563102bd353de46154191038f92c9ebde8b22a8b2749140029ec=ro+wh:~/tca_agent/image_layer_dir/104adb8634902678f87db6bdbdb12d43d5bd6db9909ae9b12e078286046a1298=ro+wh:~/tca_agent/image_layer_dir/00450b5308ac99846ae7e5fa47652952c4fbbe82882ac241d5153d630644f790=ro+wh:~/tca_agent/image_layer_dir/129675caf5fdc1616c619d5b5718417806a64f282d324a3a580d6df1269b4f3f=ro+wh:~/tca_agent/image_layer_dir/8ce8b37ab4829a1fd34fcd38842b912d46eb3f7511365ccec0399a06670ab2fc=ro+wh:~/tca_agent/image_layer_dir/57080e2e0baad381605079107f08435133d7829364a9c450fc08877f01e57601=ro+wh:~/tca_agent/image_layer_dir/9ca225075a8c2bfd27ef5084e41335d781d24e7be0cbf4575ec3d42de662c6ac=ro+wh:~/tca_agent/image_layer_dir/74ec3835691908f9e6e271797f373257de3f9cc4bb408fd66dd229537ea5fcc1=ro+wh:~/tca_agent/image_layer_dir/59aa8f04c38abaae9c0e430d7b1a91f6560641e429386ee2c4eec57f0af35c04=ro+wh:~/tca_agent/image_layer_dir/bc318ac48b4f7a9536b72e2b0f223726a5225e13ecc70eba4b7b00e2bf80081b=ro+wh:~/tca_agent/image_layer_dir/bbfb0e8818be82ca0f17f280f7ad89497fef6c92e2bb50c40b2bd17c79347425=ro+wh:~/tca_agent/image_layer_dir/f36b94436263ce21d885d2f3f94c7b307e966a989fcefd3027c039e987d7dc2b=ro+wh:~/tca_agent/image_layer_dir/9103dae307f5748103f89093273329a523300b4f103a1d397c44abd766fe0015=ro+wh:~/tca_agent/image_layer_dir/9bd48cc89c1fc083b0db7ed45e5d7e4fec277450b8b47f96884588930ce8c56f=ro+wh:~/tca_agent/image_layer_dir/47ba0411cc8344ab1895a6b8eb0878a9ffd34410170a140ad1f210f20eedcdce=ro+wh:~/tca_agent/image_layer_dir/42b317de582399eb395b2818b4d658fb0a5987e8df1163e49ac2d8bec95a078e=ro+wh:~/tca_agent/image_layer_dir/57bb07a87ab6c29b048638c65566febe800fe79672730f7bb9e70b8f2e677e5a=ro+wh:~/tca_agent/image_layer_dir/b89b49aa036df19c6a2e77cc4aaef707ab3fd916d2d936b9e5e160d448d96ab3=ro+wh:~/tca_agent/image_layer_dir/d7bf931f8235cc7cc68c223b2945f77e858eb8cff4c9cb8bd64bacfd29312672=ro+wh:~/tca_agent/image_layer_dir/49a8b40dbec97066dbad4fb14d1bf388102190442679527e112b030270426ccc=ro+wh:~/tca_agent/image_layer_dir/05f05d402ea8ee67da1af2c9e35d10b9619b0f0c14a56788a1a0b5eeb290d685=ro+wh:~/tca_agent/image_layer_dir/b05d3f32ac4ff52a542dfcf50dbf155d060d79bd23d0ebed1439a3c6b1120731=ro+wh:~/tca_agent/image_layer_dir/0d061258f32c904c95aa020a9f679790c5722c3017eef98e298d6e29b4f02089=ro+wh:~/tca_agent/image_layer_dir/1f9c07049bcd59c59413c1706d0402b04c96598174eb16ef3de25b4e47413ad2=ro+wh:~/tca_agent/image_layer_dir/a86578a8bff61017b80eb653705c3f41136efb9b88facd6a2c67e8b3426e47f9=ro+wh:~/tca_agent/image_layer_dir/c3fdf4a694f0cc03939ee2cfdd09fb623966c5bb193778eaaea317655773656e=ro+wh:~/tca_agent/image_layer_dir/1b8fcd446a37050b55f57687aaae1150d74cc7f4468bbd00942535bad5ab22fe=ro+wh:~/tca_agent/image_layer_dir/6624cfa732b528cf7c1996719e30d1525aa27af7584f61a149d4d386aa8cf301=ro+wh:~/tca_agent/image_layer_dir/5b57e87f9b5859d902c4338c7a7ce5996a51fb8226a8f11ab29e10af4af5f14f=ro+wh:~/tca_agent/image_layer_dir/0c65112ac5c572a950e2671f903ef11e918e6e3cdbf026edda90db6c7a9c6ef8=ro+wh:~/tca_agent/image_layer_dir/ce16b72d243b82ded684a547da1400b8f2d07ed7b36b114ae0cbe2f20c17b0bf=ro+wh:~/tca_agent/image_layer_dir/a3937b112d7dbedfe075162862e404b7b85803d880589eaf3ebad9855629bdd5=ro+wh:~/tca_agent/image_layer_dir/b486d646cd9f5b8151856133ea3e81d53c3664bb727a0a87d0197cbbae9211de=ro+wh:~/tca_agent/image_layer_dir/de1b712fcfedbc3f61248c1a5fb9cba5a5ab6c7415f2c71c7ea162fd7c738c6f=ro+wh:~/tca_agent/image_layer_dir/2958a858559d3091b8162c066cfe5e17012f2307772180e702ffbc89bcae8fc2=ro+wh:~/tca_agent/image_layer_dir/14eae848ef41eb275ad37cc9d12dc276d3f08beeb06e041407371b9489335ee1=ro+wh:~/tca_agent/image_layer_dir/d72e07c403501a4abefaa80f3b81121392c42f314fc14bbf1bb434dc84457dd5=ro+wh:~/tca_agent/image_layer_dir/ee0efde24e35b4e2f801ca25640169ca2f319f9b5d37dbb0917cfd43e818d1f4=ro+wh:~/tca_agent/image_layer_dir/67dfb4d7c7ce39829d36740e1ef5279e00320a0d2bfe06bb67b6571f1ff47627=ro+wh:~/tca_agent/image_layer_dir/b3a1a69310f719755232ed5f8509f11f549d620d723ea293f001e3d30795108b=ro+wh:~/tca_agent/image_layer_dir/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4=ro+wh:~/tca_agent/image_layer_dir/e5ad7970bc69d2ba62d2bbb4b80627273350e1982ff43bc1ca04a3215bc6da5b=ro+wh none ~/tca_agent/container_root_dir/51509032
dmesg : [343090.744067] aufs opt_add:810:mount[30864]: lookup failed /root/tca_agent/image_layer_di (-2)
------------------------------------------------------------------------

br option is cut and aufs search cut directory. Length of mount option
is about 6400. So I tested again with reduced option to about 4000
characters (PAGE_SIZE 4096 in kernel) by reducing branches, AUFS works well.

So I looked copy_mount_options() function in the kernel. This function
copys mount option form user memory to kernel memory within PAGE_SIZE(4096).