Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1268634

Anonymous inode cleanup?

From Rajat Jain <rajatxjain@gmail.com>
Newsgroups linux.kernel
Subject Anonymous inode cleanup?
Date 2015-11-13 06:50 +0100
Message-ID <qufpg-2lu-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Hello,

I'm writing a module that wants to get anonymous fd [using
anon_inode_getfd()] and my code looks like this:

fd = anon_inode_getfd(...)
if (fd < 0)
    return -EINVAL;

if (foobar_fail()) {
    /* undo everything */
    return -EINVAL;
}

My question is that in case of a failure after the anon_inode_getfd(),
I want to cleanup and undo whatever needs to be done w.r.t. anodnymous
fd I just allocated. (May be put a reference, or return the fd to the
free pool or whatever). Can some one please let me know what cleanup
needs to be done?

However neither I see a cleanup function, nor I see any of the drivers
attempting
to free the fd in case of failure.

Thanks,

Thanks,

Rajat
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Anonymous inode cleanup? Rajat Jain <rajatxjain@gmail.com> - 2015-11-13 06:50 +0100
  Re: Anonymous inode cleanup? Mateusz Guzik <mguzik@redhat.com> - 2015-11-13 07:00 +0100
  Re: Anonymous inode cleanup? Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-13 07:40 +0100

csiph-web