~ubuntu-branches/ubuntu/karmic/aufs/karmic

« back to all changes in this revision

Viewing changes to fs/aufs25/sbinfo.c

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2008-05-15 14:36:42 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080515143642-socrun1a13fn8q24
Tags: 0+20080514-2
* Change aufs-source structure, fixing issues with module path:
  - [fs/aufs25/] Make it top level
  - [fs/aufs/] Move into old/

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
/*
20
20
 * superblock private data
21
21
 *
22
 
 * $Id: sbinfo.c,v 1.3 2008/05/04 23:52:41 sfjro Exp $
 
22
 * $Id: sbinfo.c,v 1.4 2008/05/12 00:28:22 sfjro Exp $
23
23
 */
24
24
 
25
25
#include <linux/mnt_namespace.h>
226
226
        }
227
227
}
228
228
 
 
229
//todo: do not use BKL.
229
230
//todo: dirty
 
231
/*
 
232
 * when you mntput() for the return value of this function,
 
233
 * you have to store it to your local var.
 
234
 * ie. never mntput si_mntcache directly.
 
235
 */
230
236
struct vfsmount *au_mntcache_get(struct super_block *sb)
231
237
{
232
238
        struct au_sbinfo *sbinfo;
233
239
        struct mnt_namespace *ns;
234
 
        struct vfsmount *pos;
 
240
        struct vfsmount *pos, *mnt;
235
241
 
236
242
        AuTraceEnter();
237
 
        //todo: check lock again
238
243
 
239
244
        sbinfo = au_sbi(sb);
 
245
 
 
246
        /* ->umount_begin() is protected by BKL */
 
247
        lock_kernel();
240
248
        if (sbinfo->si_mntcache)
241
249
                goto out;
242
250
 
243
 
        /*  update si_mnt without sbinfo write lock */
244
 
        //todo: big kernel lock?
245
251
        /* vfsmount_lock is not exported */
246
252
        //root_mnt = current->fs->root.mnt;
247
253
        /* no get/put */
251
257
        list_for_each_entry(pos, &ns->list, mnt_list)
252
258
                if (pos->mnt_sb == sb) {
253
259
                        sbinfo->si_mntcache = pos;
254
 
                        smp_mb();
255
260
                        break;
256
261
                }
257
 
 
258
 
 out:
259
262
        AuDebugOn(!sbinfo->si_mntcache);
260
 
        return mntget(sbinfo->si_mntcache);
 
263
 
 
264
 out:
 
265
        mnt = mntget(sbinfo->si_mntcache);
 
266
        unlock_kernel();
 
267
        return mnt;
261
268
}