2019-11-08 21:34:31

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 01/16] staging: exfat: use prandom_u32() for i_generation

Similar to commit 46c9a946d766 ("shmem: use monotonic time for i_generation")
we should not use the deprecated get_seconds() interface for i_generation.

prandom_u32() is the replacement used in other file systems.

Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/staging/exfat/exfat_super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 3b2b0ceb7297..da76c607f589 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -26,7 +26,7 @@
#include <linux/sched.h>
#include <linux/fs_struct.h>
#include <linux/namei.h>
-
+#include <linux/random.h>
#include <linux/string.h>
#include <linux/nls.h>
#include <linux/mutex.h>
@@ -3314,7 +3314,7 @@ static int exfat_fill_inode(struct inode *inode, struct file_id_t *fid)
inode->i_uid = sbi->options.fs_uid;
inode->i_gid = sbi->options.fs_gid;
INC_IVERSION(inode);
- inode->i_generation = get_seconds();
+ inode->i_generation = prandom_u32();

if (info.Attr & ATTR_SUBDIR) { /* directory */
inode->i_generation &= ~1;
--
2.20.0


2019-11-08 21:55:04

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: [PATCH 01/16] staging: exfat: use prandom_u32() for i_generation

On Fri, 08 Nov 2019 22:32:39 +0100, Arnd Bergmann said:
> Similar to commit 46c9a946d766 ("shmem: use monotonic time for i_generation")
> we should not use the deprecated get_seconds() interface for i_generation.
>
> prandom_u32() is the replacement used in other file systems.
>
> Signed-off-by: Arnd Bergmann <[email protected]>

exfat does some weird stuff with i_generation. but (a) it doesn't require
monotonic increasing values and (b) this change is orthogonal to the weirdness
and won't break anything.

For the exfat part:

Acked-by: Valdis Kletnieks <[email protected]>


Attachments:
(No filename) (849.00 B)