Skip to contentSkip to conversation

fsfreeze: moving from uniterruptible to killable

RFC In review Marco Stornelli 2 participants 5 messages Mar 24, 2013 – Mar 27, 2013 VFS

lore
Share & tools
lore
#0 lore raw

RFC 1/1 fsfreeze: moving from uniterruptible to killable

When a fs is frozen, a process can hang because we wait in uniterruptible state. We give the user the possibility to kill the process.

---

super.c renamed from super.c.orig +2 -2
@@ -1198,7 +1198,7 @@ retry:
 	if (unlikely(sb->s_writers.frozen >= level)) {
 		if (!wait)
 			return 0;
-		wait_event(sb->s_writers.wait_unfrozen,
+		wait_event_killable(sb->s_writers.wait_unfrozen,
 			   sb->s_writers.frozen < level);
 	}
 
@@ -1248,7 +1248,7 @@ static void sb_wait_write(struct super_b
 		 * of frozen and checking of the counter
 		 */
 		prepare_to_wait(&sb->s_writers.wait, &wait,
-				TASK_UNINTERRUPTIBLE);
+				 TASK_KILLABLE);
 
 		writers = percpu_counter_sum(&sb->s_writers.counter[level-1]);
 		if (writers)
reviewer
#1 lore raw
Quoted 2 lines · Marco Stornelli

When a fs is frozen, a process can hang because we wait in uniterruptible state. We give the user the possibility to kill the process.

Yes, but it needs slightly more work as you probably know... (bailing out
properly when the signal arrives).

Honza

Quoted 24 lines

---

super.c renamed from super.c.orig +2 -2
@@ -1198,7 +1198,7 @@ retry:
 	if (unlikely(sb->s_writers.frozen >= level)) {
 		if (!wait)
 			return 0;
-		wait_event(sb->s_writers.wait_unfrozen,
+		wait_event_killable(sb->s_writers.wait_unfrozen,
 			   sb->s_writers.frozen < level);
 	}
 
@@ -1248,7 +1248,7 @@ static void sb_wait_write(struct super_b
 		 * of frozen and checking of the counter
 		 */
 		prepare_to_wait(&sb->s_writers.wait, &wait,
-				TASK_UNINTERRUPTIBLE);
+				 TASK_KILLABLE);
 
 		writers = percpu_counter_sum(&sb->s_writers.counter[level-1]);
 		if (writers)
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#2 lore raw

2013/3/26 Jan Kara <[email protected]>:

Quoted 8 lines · Marco Stornelli
Quoted 2 lines

When a fs is frozen, a process can hang because we wait in uniterruptible state. We give the user the possibility to kill the process.

Yes, but it needs slightly more work as you probably know... (bailing out
properly when the signal arrives).

Honza

Of course, indeed, it was only an RFC to start a discussion, not a patch :) The point was: is this kind of change a behaviour that can break user-space in some way? IMHO no, but I'd like to have a discussion about that before to start coding. What do you think?

Marco

reviewer
#3 lore raw
Quoted 7 lines · Marco Stornelli

2013/3/26 Jan Kara <[email protected]>:

Quoted 6 lines · Marco Stornelli
Quoted 2 lines

When a fs is frozen, a process can hang because we wait in uniterruptible state. We give the user the possibility to kill the process.

Yes, but it needs slightly more work as you probably know... (bailing out
properly when the signal arrives).

Quoted 7 lines
Quoted 2 lines

Honza

Of course, indeed, it was only an RFC to start a discussion, not a patch :) The point was: is this kind of change a behaviour that can break user-space in some way? IMHO no, but I'd like to have a discussion about that before to start coding. What do you think?

Killable wait is almost always safe WRT to userspace breakage. In this
case I cannot see how it could matter. That's why I agree it's a good thing to do.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#4 lore raw

2013/3/27 Jan Kara <[email protected]>:

Quoted 15 lines · Marco Stornelli
Quoted 7 lines

2013/3/26 Jan Kara <[email protected]>:

Quoted 6 lines · Marco Stornelli
Quoted 2 lines

When a fs is frozen, a process can hang because we wait in uniterruptible state. We give the user the possibility to kill the process.

Yes, but it needs slightly more work as you probably know... (bailing out
properly when the signal arrives).

Quoted 7 lines
Quoted 2 lines

Honza

Of course, indeed, it was only an RFC to start a discussion, not a patch :) The point was: is this kind of change a behaviour that can break user-space in some way? IMHO no, but I'd like to have a discussion about that before to start coding. What do you think?

Quoted 5 lines

Killable wait is almost always safe WRT to userspace breakage. In this
case I cannot see how it could matter. That's why I agree it's a good thing to do.

Honza

Yes, I quite agree. I'll try to look at it in a deeply way.

Regards,

Marco