[Yaffs] Using Yaffs with U-Boot, problem with mount/ unmount…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kjetil Aamodt
Date:  
To: yaffs
Subject: [Yaffs] Using Yaffs with U-Boot, problem with mount/ unmount/ mount
Hi

I'm using Yaffs on a PPC based system from U-Boot and I have faced a
problem with mount/ unmount.

It seems like
int yaffs_unmount(const YCHAR *path)
is not cleaning completely. Any one that have experienced the same?

When I do a mount, unmount and then mount again I got the following output:
Mount point name already used

I have investigated a bit and I could not find any places the mount
point name is cleared. Currently I see two possible fixes:

Make sure that name and driver_context are reset in unmount:
diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
index 00d1c5a..abbbf44 100644
--- a/fs/yaffs2/yaffs_guts.c
+++ b/fs/yaffs2/yaffs_guts.c
@@ -4942,6 +4942,8 @@ void yaffs_deinitialise(struct yaffs_dev *dev)
                 for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++)
                         kfree(dev->temp_buffer[i].buffer);


+               dev->param.name = '\0';
+               dev->driver_context = NULL;
                 dev->is_mounted = 0;


                 if (dev->param.deinitialise_flash_fn)


- or -

Make sure that we don't check partitions that are unmounted:
diff --git a/fs/yaffs2/yaffs_uboot_glue.c b/fs/yaffs2/yaffs_uboot_glue.c
index 5fc6563..5754435 100644
--- a/fs/yaffs2/yaffs_uboot_glue.c
+++ b/fs/yaffs2/yaffs_uboot_glue.c
@@ -199,6 +199,8 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
                 chk = yaffs_next_dev();
                 if (!chk)
                         break;
+               if (!chk->is_mounted)
+                       continue;
                 if (strcmp(chk->param.name, mp) == 0) {
                         printf("Mount point name already used\n");
                         goto err;


It looks like both will work, but I don't know if I'm only masking a
more serious bug with this approach.

My use case is:
- mount and use some files from /flash
- unmount and erase the whole NAND
- mount and use the /flash again

Best regards,
Kjetil Aamodt