On Fri, Jun 22, 2018 at 12:45:10PM -0700, Randy Dunlap wrote: > > + * Context: Any context. Frequently called while holding sb_lock. > > + * Return: 0 on success, -EMFILE if there are no anonymous bdevs left > > + * or -EAGAIN if memory allocation failed. > > Looks to me like the code used to return -ENOMEM and used -EAGAIN as an > internal retry code. > > confused? (/me) Quite right. +++ b/fs/super.c @@ -989,7 +989,7 @@ static DEFINE_IDA(unnamed_dev_ida); * * Context: Any context. Frequently called while holding sb_lock. * Return: 0 on success, -EMFILE if there are no anonymous bdevs left - * or -EAGAIN if memory allocation failed. + * or -ENOMEM if memory allocation failed. */ int get_anon_bdev(dev_t *p) { @@ -1002,9 +1002,9 @@ int get_anon_bdev(dev_t *p) dev = ida_alloc_range(&unnamed_dev_ida, 1, (1 << MINORBITS) - 1, GFP_ATOMIC); if (dev == -ENOSPC) - return -EMFILE; + dev = -EMFILE; if (dev < 0) - return -EAGAIN; + return dev; *p = MKDEV(0, dev); return 0;