Move setting up ->private and taking the reference to the network namespace into exports_net_init() and dropping it into exports_net_put(). The procfs file needs them without the seq_open() and seq_release() around them.
No functional changes. Signed-off-by: Christian Brauner (Amutable) <[email protected]> --- fs/nfsd/nfsctl.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index f32311f2d7cf..f8ce3c0fb077 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -143,28 +143,36 @@ static const struct file_operations transaction_ops = { .llseek = default_llseek, }; +static void exports_net_init(struct net *net, struct seq_file *seq) +{ + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + + seq->private = nn->svc_export_cache; + get_net(net); +} + +static void exports_net_put(struct seq_file *seq) +{ + struct cache_detail *cd = seq->private; + + put_net(cd->net); +} + static int exports_net_open(struct net *net, struct file *file) { int err; - struct seq_file *seq; - struct nfsd_net *nn = net_generic(net, nfsd_net_id); err = seq_open(file, &nfs_exports_op); if (err) return err; - seq = file->private_data; - seq->private = nn->svc_export_cache; - get_net(net); + exports_net_init(net, file->private_data); return 0; } static int exports_release(struct inode *inode, struct file *file) { - struct seq_file *seq = file->private_data; - struct cache_detail *cd = seq->private; - - put_net(cd->net); + exports_net_put(file->private_data); return seq_release(inode, file); } -- 2.53.0
