Skip to content

Commit

Permalink
Decrease refcount when unmounting fs
Browse files Browse the repository at this point in the history
CL: none

PUBLISHED_FROM=1cfba23a55311663b645a6051ef877ad46338814
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Feb 8, 2018
1 parent 5ab5fe1 commit 0aeacad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fw/src/mgos_vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ bool mgos_vfs_mkfs(const char *dev_type, const char *dev_opts,
if (dev_type != NULL) {
dev = mgos_vfs_dev_open(dev_type, dev_opts);
if (dev == NULL) return false;
dev->refs++;
}
struct mgos_vfs_fs fs = {.type = fe->type, .ops = fe->ops, .dev = dev};
LOG(LL_INFO, ("Create %s (dev %p, opts %s)", fs_type, dev, fs_opts));
Expand Down Expand Up @@ -902,7 +901,10 @@ static bool mgos_vfs_umount_entry(struct mgos_vfs_mount_entry *me, bool force) {
SLIST_REMOVE(&s_mounts, me, mgos_vfs_mount_entry, next);
ret = me->fs->ops->umount(me->fs);
if (ret) {
if (me->fs->dev) mgos_vfs_dev_close(me->fs->dev);
if (me->fs->dev) {
me->fs->dev->refs--;
mgos_vfs_dev_close(me->fs->dev);
}
free(me->fs);
free(me);
}
Expand Down

0 comments on commit 0aeacad

Please sign in to comment.