From 5d46770f5f8bb0eff0a82596860958be13e7baf1 Mon Sep 17 00:00:00 2001 From: Anton Altaparmakov Date: Mon, 12 Sep 2005 14:33:47 +0100 Subject: [PATCH 1/2] NTFS: Change the mount options {u,f,d}mask to always parse the number as an octal number to conform to how chmod(1) works, too. Thanks to Giuseppe Bilotta and Horst von Brand for pointing out the errors of my ways. Signed-off-by: Anton Altaparmakov --- fs/ntfs/ChangeLog | 6 +++++- fs/ntfs/super.c | 14 +++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index e4fd6134244d..7f4007242893 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog @@ -90,7 +90,11 @@ ToDo/Notes: in the first buffer head instead of a driver global spin lock to improve scalability. - Minor fix to error handling and error message display in - fs/ntfs/aops.c::ntfs_prepare_nonresident_write(). + fs/ntfs/aops.c::ntfs_prepare_nonresident_write(). + - Change the mount options {u,f,d}mask to always parse the number as + an octal number to conform to how chmod(1) works, too. Thanks to + Giuseppe Bilotta and Horst von Brand for pointing out the errors of + my ways. 2.1.23 - Implement extension of resident files and make writing safe as well as many bug fixes, cleanups, and enhancements... diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index b2b392961268..453d0d51ea4b 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -126,6 +126,14 @@ static BOOL parse_options(ntfs_volume *vol, char *opt) if (*v) \ goto needs_val; \ } +#define NTFS_GETOPT_OCTAL(option, variable) \ + if (!strcmp(p, option)) { \ + if (!v || !*v) \ + goto needs_arg; \ + variable = simple_strtoul(ov = v, &v, 8); \ + if (*v) \ + goto needs_val; \ + } #define NTFS_GETOPT_BOOL(option, variable) \ if (!strcmp(p, option)) { \ BOOL val; \ @@ -157,9 +165,9 @@ static BOOL parse_options(ntfs_volume *vol, char *opt) *v++ = 0; NTFS_GETOPT("uid", uid) else NTFS_GETOPT("gid", gid) - else NTFS_GETOPT("umask", fmask = dmask) - else NTFS_GETOPT("fmask", fmask) - else NTFS_GETOPT("dmask", dmask) + else NTFS_GETOPT_OCTAL("umask", fmask = dmask) + else NTFS_GETOPT_OCTAL("fmask", fmask) + else NTFS_GETOPT_OCTAL("dmask", dmask) else NTFS_GETOPT("mft_zone_multiplier", mft_zone_multiplier) else NTFS_GETOPT_WITH_DEFAULT("sloppy", sloppy, TRUE) else NTFS_GETOPT_BOOL("show_sys_files", show_sys_files) From 89ecf38c7aee6eb3f6aaf40a6d196ddff4b6d4a8 Mon Sep 17 00:00:00 2001 From: Anton Altaparmakov Date: Mon, 12 Sep 2005 15:43:03 +0100 Subject: [PATCH 2/2] NTFS: Mask out __GFP_HIGHMEM when doing kmalloc() in __ntfs_malloc() as it otherwise causes a BUG(). Signed-off-by: Anton Altaparmakov --- fs/ntfs/ChangeLog | 3 --- fs/ntfs/malloc.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 7f4007242893..49eafbdb15c1 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog @@ -34,9 +34,6 @@ ToDo/Notes: journals with two different restart pages. We sanity check both and either use the only sane one or the more recent one of the two in the case that both are valid. - - Modify fs/ntfs/malloc.h::ntfs_malloc_nofs() to do the kmalloc() based - allocations with __GFP_HIGHMEM, analogous to how the vmalloc() based - allocations are done. - Add fs/ntfs/malloc.h::ntfs_malloc_nofs_nofail() which is analogous to ntfs_malloc_nofs() but it performs allocations with __GFP_NOFAIL and hence cannot fail. diff --git a/fs/ntfs/malloc.h b/fs/ntfs/malloc.h index 9994e019a3cf..3288bcc2c4aa 100644 --- a/fs/ntfs/malloc.h +++ b/fs/ntfs/malloc.h @@ -45,7 +45,7 @@ static inline void *__ntfs_malloc(unsigned long size, if (likely(size <= PAGE_SIZE)) { BUG_ON(!size); /* kmalloc() has per-CPU caches so is faster for now. */ - return kmalloc(PAGE_SIZE, gfp_mask); + return kmalloc(PAGE_SIZE, gfp_mask & ~__GFP_HIGHMEM); /* return (void *)__get_free_page(gfp_mask); */ } if (likely(size >> PAGE_SHIFT < num_physpages))